Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:This routine handles present pages, when users try to write* to a shared page. It is done by copying the page to a new address* and decrementing the shared-page counter for the old page.* Note that this routine assumes that the protection checks have been

Proto:static vm_fault_t do_wp_page(struct vm_fault *vmf)__releases(vmf->ptl)

Type:vm_fault_t

Parameter:

TypeParameterName
struct vm_fault *vmf
2717  vma = Target VMA
2719  ->fault handlers should return a* page here, unless VM_FAULT_NOPAGE* is set (which is also implied by* VM_FAULT_ERROR). = vm_normal_page -- This function gets the "struct page" associated with a pte.* "Special" mappings do not wish to be associated with a "struct page" (either* it doesn't exist, or it exists but they don't want to touch it). In this
2720  If Not ->fault handlers should return a* page here, unless VM_FAULT_NOPAGE* is set (which is also implied by* VM_FAULT_ERROR). Then
2728  If (Flags, see mm.h. & (VM_WRITE | VM_SHARED)) == (VM_WRITE | VM_SHARED) Then Return Handle write page faults for VM_MIXEDMAP or VM_PFNMAP for a VM_SHARED* mapping
2732  pte_unmap_unlock(Pointer to pte entry matching* the 'address'. NULL if the page* table hasn't been allocated., Page table lock.* Protects pte page table if 'pte'* is not NULL, otherwise pmd.)
2733  Return Handle the case of a page which we actually need to copy to a new page.* Called with mmap_sem locked and the old page referenced, but* without the ptl held.* High level logic flow:* - Allocate a page, copy the content of the old page to the new one.
2740  If PageAnon(->fault handlers should return a* page here, unless VM_FAULT_NOPAGE* is set (which is also implied by* VM_FAULT_ERROR).) Then
2742  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 && (PageSwapCache(->fault handlers should return a* page here, unless VM_FAULT_NOPAGE* is set (which is also implied by* VM_FAULT_ERROR).) || page_count(->fault handlers should return a* page here, unless VM_FAULT_NOPAGE* is set (which is also implied by* VM_FAULT_ERROR).) != 1 ) Then Go to copy
2763  If Not reused Then Go to copy
2766  Return VM_FAULT_WRITE
2769  If total_map_swapcount == 1 Then
2781  Return VM_FAULT_WRITE
2783  lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
2784  Else if Value for the false possibility is greater at compile time((Flags, see mm.h. & (VM_WRITE | VM_SHARED)) == (VM_WRITE | VM_SHARED)) Then
2786  Return wp_page_shared(vmf)
2788  copy :
2792  get_page(->fault handlers should return a* page here, unless VM_FAULT_NOPAGE* is set (which is also implied by* VM_FAULT_ERROR).)
2794  pte_unmap_unlock(Pointer to pte entry matching* the 'address'. NULL if the page* table hasn't been allocated., Page table lock.* Protects pte page table if 'pte'* is not NULL, otherwise pmd.)
2795  Return Handle the case of a page which we actually need to copy to a new page.* Called with mmap_sem locked and the old page referenced, but* without the ptl held.* High level logic flow:* - Allocate a page, copy the content of the old page to the new one.
Caller
NameDescribe
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
handle_pte_faultThese routines also need to handle stuff like marking pages dirty* and/or accessed for architectures that don't do it in hardware (most* RISC architectures)