函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\memory.c Create Date:2022-07-27 16:08:54
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:cow_user_page

函数原型:static inline bool cow_user_page(struct page *dst, struct page *src, struct vm_fault *vmf)

返回类型:bool

参数:

类型参数名称
struct page *dst
struct page *src
struct vm_fault *vmf
2223  __useruaddr
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  如果此条件成立可能性大(为编译器优化)(src)则
2232  copy_user_highpage(dst, src, addr, vma)
2233  返回:true
2242  kaddr等于kmap_atomic(dst)
2243  uaddr__user等于addr按位与PAGE_MASK
2249  如果arch_faults_on_old_pte()且非pte_young(Value of PTE at the time of fault )则
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  转到:pte_unlock
2265  entry等于pte_mkyoung(Value of PTE at the time of fault )
2266  如果ptep_set_access_flags(vma, addr, Pointer to pte entry matching* the 'address'. NULL if the page* table hasn't been allocated., entry, 0)则The x86 doesn't have any external MMU info: the kernel page* tables contain all the necessary information.
2276  如果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
2277  如果locked则转到: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  转到:pte_unlock
2298  warn :
2299  WARN_ON_ONCE(1)
2300  clear_page(kaddr)
2304  ret = true
2306  pte_unlock :
2307  如果lockedpte_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  返回:ret
调用者
名称描述
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.