Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name: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

Proto:static struct page *stable_tree_search(struct page *page)

Type:struct page

Parameter:

TypeParameterName
struct page *page
1560  page_node = page_stable_node(page)
1561  If page_node && when listed for migration != Recently migrated nodes of stable tree, pending proper placement Then
1563  get_page(page)
1564  Return page
1567  nid = This helper is used for getting right index into array of tree roots.* When merge_across_nodes knob is set to 1, there are only two rb-trees for* stable and unstable pages from all nodes with roots in index 0. Otherwise,
1568  root = root_stable_tree + nid
1569  again :
1570  new = rb_node
1571  parent = NULL
1573  When new cycle
1577  cond_resched()
1578  stable_node = rb_entry( * new, structstable_node, node)
1579  stable_node_any = NULL
1580  tree_page = chain_prune( & stable_node_dup, & stable_node, root)
1593  If Not stable_node_dup Then
1601  If Not stable_node_any Then
1603  Go to again
1617  VM_BUG_ON(!stable_node_dup ^ !!stable_node_any)
1618  If Not tree_page Then
1628  Go to again
1631  ret = memcmp_pages(page, tree_page)
1632  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
1634  parent = new
1635  If ret < 0 Then new = rb_left
1637  Else if ret > 0 Then new = rb_right
1639  Else
1640  If page_node Then
1652  If Not stable_node_dup Then
1665  Return NULL
1678  If PTR_ERR(tree_page) == -EBUSY Then Return ERR_PTR( - EBUSY)
1694  Return tree_page
1698  If Not page_node Then Return NULL
1701  deletes entry from list
1702  DO_NUMA(nid = nid)
1703  rb_link_node( & when node of stable tree , parent, new)
1704  rb_insert_color( & when node of stable tree , root)
1705  out :
1706  If is_page_sharing_candidate(page_node) Then
1707  get_page(page)
1708  Return page
1709  Else Return NULL
1712  replace :
1721  If stable_node_dup == stable_node Then
1722  VM_BUG_ON(is_stable_node_chain(stable_node_dup))
1723  VM_BUG_ON(is_stable_node_dup(stable_node_dup))
1725  If page_node Then
1728  DO_NUMA(nid = nid)
1734  Else page = NULL
1736  Else
1738  page = NULL
1740  Else
1741  VM_BUG_ON(!is_stable_node_chain(stable_node))
1742  __stable_node_dup_del(stable_node_dup)
1743  If page_node Then
1746  DO_NUMA(nid = nid)
1750  Else page = NULL
1752  Else
1753  page = NULL
1756  when listed for migration = Recently migrated nodes of stable tree, pending proper placement
1757  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
1758  Return page
1760  chain_append :
1762  If Not stable_node_dup Then stable_node_dup = stable_node_any
1772  If stable_node_dup == stable_node Then
1773  VM_BUG_ON(is_stable_node_chain(stable_node_dup))
1774  VM_BUG_ON(is_stable_node_dup(stable_node_dup))
1776  stable_node = alloc_stable_node_chain(stable_node_dup, root)
1778  If Not stable_node Then Return NULL
1787  VM_BUG_ON(!is_stable_node_chain(stable_node))
1788  VM_BUG_ON(!is_stable_node_dup(stable_node_dup))
1789  VM_BUG_ON(when listed for migration != & Recently migrated nodes of stable tree, pending proper placement )
1790  deletes entry from list
1791  DO_NUMA(nid = nid)
1792  stable_node_chain_add_dup(page_node, stable_node)
1793  Go to out
Caller
NameDescribe
cmp_and_merge_pagemp_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