Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:cow_user_page

Proto:static inline bool cow_user_page(struct page *dst, struct page *src, struct vm_fault *vmf)

Type:bool

Parameter:

TypeParameterName
struct page *dst
struct page *src
struct vm_fault *vmf
2223  __user * uaddr
2224  bool locked = false
2225  vma = Target VMA
2226  mm = The address space we belong to.
2227  addr = Faulting virtual address
2229  debug_dma_assert_idle(src)
2231  If Value is more likely to compile time(src) Then
2232  copy_user_highpage(dst, src, addr, vma)
2233  Return true
2242  kaddr = kmap_atomic(dst)
2243  uaddr * __user = addr & PAGE_MASK
2249  If arch_faults_on_old_pte() && Not pte_young(Value of PTE at the time of fault ) Then
2252  Pointer to pte entry matching* the 'address'. NULL if the page* table hasn't been allocated. = pte_offset_map_lock(mm, Pointer to pmd entry matching* the 'address' , addr, & Page table lock.* Protects pte page table if 'pte'* is not NULL, otherwise pmd.)
2253  locked = true
2261  ret = false
2262  Go to pte_unlock
2265  entry = pte_mkyoung(Value of PTE at the time of fault )
2266  If ptep_set_access_flags(vma, addr, Pointer to pte entry matching* the 'address'. NULL if the page* table hasn't been allocated., entry, 0) Then The x86 doesn't have any external MMU info: the kernel page* tables contain all the necessary information.
2276  If Architectures should provide two primitives (raw_copy_{to,from}_user())* and get rid of their private instances of copy_{to,from}_user() and* __copy_{to,from}_user{,_inatomic}().* raw_copy_{to,from}_user(to, from, size) should copy up to size bytes and Then
2277  If locked Then Go to warn
2281  Pointer to pte entry matching* the 'address'. NULL if the page* table hasn't been allocated. = pte_offset_map_lock(mm, Pointer to pmd entry matching* the 'address' , addr, & Page table lock.* Protects pte page table if 'pte'* is not NULL, otherwise pmd.)
2282  locked = true
2285  ret = false
2286  Go to pte_unlock
2298  warn :
2299  WARN_ON_ONCE(1)
2300  clear_page(kaddr)
2304  ret = true
2306  pte_unlock :
2307  If locked Then 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.)
2309  Prevent people trying to call kunmap_atomic() as if it were kunmap()* kunmap_atomic() should get the return value of kmap_atomic, not the page.(kaddr)
2310  flush_dcache_page(dst)
2312  Return ret
Caller
NameDescribe
wp_page_copyHandle 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.