函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\ksm.c Create Date:2022-07-27 17:13:55
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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,

函数原型:static struct page *get_ksm_page(struct stable_node *stable_node, enum get_ksm_page_flags flags)

返回类型:struct page

参数:

类型参数名称
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  如果READ_ONCE( See page-flags.h for PAGE_MAPPING_FLAGS )不等于expected_mapping则转到:stale
719  当非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.循环
728  如果非PageSwapCache(page)则转到:stale
730  cpu_relax()
733  如果READ_ONCE( See page-flags.h for PAGE_MAPPING_FLAGS )不等于expected_mapping
734  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
735  转到:stale
738  如果flags恒等于GET_KSM_PAGE_TRYLOCK
741  返回:错误号
743  否则如果flags恒等于GET_KSM_PAGE_LOCKlock_page may only be called if we have the page's inode pinned.
746  如果flags不等于GET_KSM_PAGE_NOLOCK
750  转到:stale
753  返回:page
755  stale :
762  smp_rmb()
763  如果READ_ONCE(kpfn)不等于kpfn则转到:again
765  remove_node_from_stable_tree(stable_node)
766  返回:NULL
调用者
名称描述
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