Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:We use break_ksm to break COW on a ksm page: it's a stripped down* if (get_user_pages(addr, 1, 1, 1, &page, NULL) == 1)* put_page(page);* but taking great care only to touch a ksm page, in a VM_MERGEABLE vma,

Proto:static int break_ksm(struct vm_area_struct *vma, unsigned long addr)

Type:int

Parameter:

TypeParameterName
struct vm_area_struct *vma
unsigned longaddr
473  ret = 0
475  Do
476  cond_resched()
477  page = follow_page(vma, addr, do get_page on page | wait for page to replace migration entry | we are working on non-current tsk/mm )
479  If IS_ERR_OR_NULL(page) Then Break
481  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 ret = By the time we get here, we already hold the mm semaphore* The mmap_sem may have been released depending on flags and our* return value. See filemap_fault() and __lock_page_or_retry().
484  Else ret = VM_FAULT_WRITE
486  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
487  When Not (ret & ( VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | VM_FAULT_OOM)) cycle
516  Return If ret & VM_FAULT_OOM Then -ENOMEM Else 0
Caller
NameDescribe
break_cow
unmerge_ksm_pagesThough it's very tempting to unmerge rmap_items from stable tree rather* than check every pte of a given vma, the locking doesn't quite work for* that - an rmap_item is assigned to the stable tree after inserting ksm* page and upping mmap_sem