Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:mp_and_merge_page - first see if page can be merged into the stable tree;* if not, compare checksum to previous and if it's the same, see if page can* be inserted into the unstable tree, or merged with a page already there and

Proto:static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)

Type:void

Parameter:

TypeParameterName
struct page *page
struct rmap_item *rmap_item
2037  mm = mm
2039  struct page * tree_page = NULL
2044  bool max_page_sharing_bypass = false
2046  stable_node = page_stable_node(page)
2047  If stable_node Then
2055  If when listed for migration != Recently migrated nodes of stable tree, pending proper placement && when listed from stable tree == stable_node Then Return
2062  If Not is_page_sharing_candidate(stable_node) Then max_page_sharing_bypass = true
2067  kpage = stable_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
2068  If kpage == page && when listed from stable tree == stable_node Then
2069  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
2070  Return
2073  Removing rmap_item from stable or unstable tree.* This function will clean the information from the stable/unstable tree.
2075  If kpage Then
2076  If PTR_ERR(kpage) == -EBUSY Then Return
2079  err = ry_to_merge_with_ksm_page - like try_to_merge_two_pages,* but no new kernel page is allocated: kpage must already be a ksm page.* This function returns 0 if the pages were merged, -EFAULT otherwise.
2080  If Not err Then
2090  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
2091  Return
2100  checksum = calc_checksum(page)
2101  If when unstable != checksum Then
2102  when unstable = checksum
2103  Return
2110  If Whether to merge empty (zeroed) pages with actual zero pages && checksum == Checksum of an empty (zeroed) page Then
2113  lock for reading
2114  vma = find_mergeable_vma(mm, + low bits used for flags below )
2115  err = ry_to_merge_one_page - take two pages and merge them into one*@vma: the vma that holds the pte pointing to page*@page: the PageAnon page that we want to replace with kpage*@kpage: the PageKsm page that we want to map instead of page,
2117  lease a read lock
2122  If Not err Then Return
2125  tree_rmap_item = stable_tree_search_insert - search for identical page,* else insert rmap_item into the unstable tree.* This function searches for a page in the unstable tree identical to the* page currently being scanned; and if no identical page is found in the
2127  If tree_rmap_item Then
2130  kpage = ry_to_merge_two_pages - take two identical pages and prepare them* to be merged into one page
2142  split = PageTransCompound returns true for both transparent huge pages* and hugetlbfs pages, so it should only be called when it's known* that hugetlbfs pages aren't involved. && compound_head(page) == compound_head(tree_page)
2144  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
2145  If kpage Then
2152  If stable_node Then
2166  If Not stable_node Then
2170  Else if split Then
Caller
NameDescribe
ksm_do_scanksm_do_scan - the ksm scanner main worker function.*@scan_npages: number of pages we want to scan before we return.