Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:scan_get_next_rmap_item

Proto:static struct rmap_item *scan_get_next_rmap_item(struct page **page)

Type:struct rmap_item

Parameter:

TypeParameterName
struct page **page
2224  If list_empty - tests whether a list is empty*@head: the list to test. Then Return NULL
2227  slot = mm_slot
2228  If slot == ksm_mm_head Then
2239  lru_add_drain_all()
2257  cond_resched()
2261  When nid < ksm_nr_node_ids cycle root_unstable_tree[nid] =
2264  spin_lock( & ksm_mmlist_lock)
2265  slot = list_entry - get the struct for this entry*@ptr: the &struct list_head pointer.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.(next, structmm_slot, mm_list)
2266  mm_slot = slot
2267  spin_unlock( & ksm_mmlist_lock)
2272  If slot == ksm_mm_head Then Return NULL
2274  next_mm :
2275  address = 0
2276  rmap_list = rmap_list
2279  mm = mm
2280  lock for reading
2281  If ksmd, and unmerge_and_remove_all_rmap_items(), must not touch an mm's* page tables after it has passed through ksm_exit() - which, if necessary,* takes mmap_sem briefly to serialize against them. ksm_exit() does not set Then vma = NULL
2283  Else vma = Look up the first VMA which satisfies addr < vm_end, NULL if none.
2286  When vma cycle
2287  If Not (Flags, see mm.h. & KSM may merge identical pages ) Then Continue
2289  If address < Our start address within vm_mm. Then address = Our start address within vm_mm.
2291  If Not Serialized by page_table_lock Then address = The first byte after our end addresswithin vm_mm.
2298  If IS_ERR_OR_NULL( * page) Then
2299  address += PAGE_SIZE
2300  cond_resched()
2301  Continue
2303  If PageAnon( * page) Then
2318  address += PAGE_SIZE
2319  cond_resched()
2323  If ksmd, and unmerge_and_remove_all_rmap_items(), must not touch an mm's* page tables after it has passed through ksm_exit() - which, if necessary,* takes mmap_sem briefly to serialize against them. ksm_exit() does not set Then
2324  address = 0
2325  rmap_list = rmap_list
2331  remove_trailing_rmap_items(slot, rmap_list)
2333  spin_lock( & ksm_mmlist_lock)
2334  mm_slot = list_entry - get the struct for this entry*@ptr: the &struct list_head pointer.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.(next, structmm_slot, mm_list)
2336  If address == 0 Then
2346  hash_del - remove an object from a hashtable*@node: &struct hlist_node of the object to remove
2347  deletes entry from list
2348  spin_unlock( & ksm_mmlist_lock)
2350  free_mm_slot(slot)
2351  lear_bit - Clears a bit in memory*@nr: Bit to clear*@addr: Address to start counting from* This is a relaxed atomic operation (no implied memory barriers).
2352  lease a read lock
2353  mmdrop(mm)
2354  Else
2355  lease a read lock
2363  spin_unlock( & ksm_mmlist_lock)
2367  slot = mm_slot
2368  If slot != ksm_mm_head Then Go to next_mm
2371  seqnr++
2372  Return NULL
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.