Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\ksm.c Create Date:2022-07-28 15:40:26
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:get_ksm_page: checks if the page indicated by the stable node* is still its ksm page, despite having held no reference to it.* In which case we can trust the content of the page, and it* returns the gotten page; but if the page has now been zapped,

Proto:static struct page *get_ksm_page(struct stable_node *stable_node, enum get_ksm_page_flags flags)

Type:struct page

Parameter:

TypeParameterName
struct stable_node *stable_node
enum get_ksm_page_flagsflags
701  expected_mapping = stable_node | PAGE_MAPPING_KSM
703  again :
704  kpfn = READ_ONCE(kpfn)
705  page = pfn_to_page(kpfn)
706  If READ_ONCE( See page-flags.h for PAGE_MAPPING_FLAGS ) != expected_mapping Then Go to stale
719  When Not Try to grab a ref unless the page has a refcount of zero, return false if* that is the case.* This can be called when MMU is off so it must not access* any of the virtual mappings. cycle
728  If Not PageSwapCache(page) Then Go to stale
730  cpu_relax()
733  If READ_ONCE( See page-flags.h for PAGE_MAPPING_FLAGS ) != expected_mapping Then
734  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
735  Go to stale
738  If flags == GET_KSM_PAGE_TRYLOCK Then
741  Return ERR_PTR( - EBUSY)
743  Else if flags == GET_KSM_PAGE_LOCK Then lock_page may only be called if we have the page's inode pinned.
746  If flags != GET_KSM_PAGE_NOLOCK Then
750  Go to stale
753  Return page
755  stale :
762  smp_rmb()
763  If READ_ONCE(kpfn) != kpfn Then Go to again
765  remove_node_from_stable_tree(stable_node)
766  Return NULL
Caller
NameDescribe
remove_rmap_item_from_treeRemoving rmap_item from stable or unstable tree.* This function will clean the information from the stable/unstable tree.
stable_node_dup
__stable_node_chainLike for get_ksm_page, this function can free the *_stable_node and* *_stable_node_dup if the returned tree_page is NULL
stable_tree_searchstable_tree_search - search for page inside the stable tree* This function checks if there is a page inside the stable tree* with identical content to the page that we are scanning right now
stable_tree_insertstable_tree_insert - insert stable tree node pointing to new ksm page* into the stable tree.* This function returns the stable tree node just allocated on success,* NULL otherwise.
scan_get_next_rmap_item