Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:ksm_might_need_to_copy

Proto:struct page *ksm_might_need_to_copy(struct page *page, struct vm_area_struct *vma, unsigned long address)

Type:struct page

Parameter:

TypeParameterName
struct page *page
struct vm_area_struct *vma
unsigned longaddress
2563  anon_vma = page_anon_vma(page)
2566  If A KSM page is one of those write-protected "shared pages" or "merged pages"* which KSM maps into multiple mms, wherever identical anonymous page content* is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any Then
2567  If page_stable_node(page) && Not (ksm_run & KSM_RUN_UNMERGE) Then Return page
2570  Else if Not anon_vma Then
2571  Return page
2572  Else if Root of this anon_vma tree == root && Our offset within mapping. == linear_page_index(vma, address) Then
2574  Return page
2576  If Not PageUptodate(page) Then Return page
2579  new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address)
2580  If new_page Then
2581  copy_user_highpage(new_page, page, address, vma)
2583  SetPageDirty(new_page)
2584  __SetPageUptodate(new_page)
2585  __SetPageLocked(new_page)
2588  Return new_page
Caller
NameDescribe
unuse_pteNo need to decide whether this PTE shares the swap entry with others,* just let do_wp_page work it out if a write is requested later - to* force COW, vm_page_prot omits write permission from any private vma.
do_swap_pageWe enter with non-exclusive mmap_sem (to exclude vma changes,* but allow concurrent faults), and pte mapped but not yet locked.* We return with pte unmapped and unlocked.* We return with the mmap_sem locked or unlocked in the same cases