函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:We 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

函数原型:vm_fault_t do_swap_page(struct vm_fault *vmf)

返回类型:vm_fault_t

参数:

类型参数名称
struct vm_fault *vmf
2904  vma等于Target VMA
2905  page等于NULL
2910  exclusive等于0
2911  ret等于0
2913  如果非handle_pte_fault chooses page fault handler according to an entry which was* read non-atomically则转到:out
2916  entry等于Convert the arch-dependent pte representation of a swp_entry_t into an* arch-independent swp_entry_t.
2917  如果此条件成立可能性小(为编译器优化)(non_swap_entry(entry))则
2918  如果is_migration_entry(entry)则
2921  否则如果is_device_private_entry(entry)则
2923  ret等于migrate_to_ram(vmf)
2924  否则如果is_hwpoison_entry(entry)则
2925  ret等于VM_FAULT_HWPOISON
2926  否则
2928  ret等于VM_FAULT_SIGBUS
2930  转到:out
2934  delayacct_set_flag(I am doing a swapin )
2935  page等于lookup_swap_cache(entry, vma, Faulting virtual address )
2936  swapcache等于page
2938  如果非page
2939  si等于swp_swap_info(entry)
2941  如果SWP_USED etc: see above 按位与SWP_SYNCHRONOUS_IO__swap_count(entry)恒等于1则
2946  如果page
2953  否则
2956  swapcache等于page
2959  如果非page
2969  转到:unlock
2973  ret等于VM_FAULT_MAJOR
2974  Disable counters
2975  count_memcg_event_mm(The address space we belong to. , PGMAJFAULT)
2976  否则如果PageHWPoison(page)则
2981  ret等于VM_FAULT_HWPOISON
2982  delayacct_clear_flag(I am doing a swapin )
2983  转到:out_release
2986  locked等于lock_page_or_retry - Lock the page, unless this would block and the* caller indicated that it can handle a retry.* Return value and mmap_sem implications depend on flags; see* __lock_page_or_retry().
2988  delayacct_clear_flag(I am doing a swapin )
2989  如果非locked
2990  ret或等于VM_FAULT_RETRY
2991  转到:out_release
3000  如果此条件成立可能性小(为编译器优化)((!PageSwapCache(page) || page_private(page) != val))且swapcache则转到:out_page
3004  page等于ksm_might_need_to_copy(page, vma, Faulting virtual address )
3005  如果此条件成立可能性小(为编译器优化)(!page)则
3006  ret等于VM_FAULT_OOM
3007  page等于swapcache
3008  转到:out_page
3011  如果mem_cgroup_try_charge_delay(page, The address space we belong to. , GFP_KERNEL, & memcg, false)则
3013  ret等于VM_FAULT_OOM
3014  转到:out_page
3020  Pointer to pte entry matching* the 'address'. NULL if the page* table hasn't been allocated.等于pte_offset_map_lock(The address space we belong to. , Pointer to pmd entry matching* the 'address' , Faulting virtual address , & Page table lock.* Protects pte page table if 'pte'* is not NULL, otherwise pmd.)
3022  如果此条件成立可能性小(为编译器优化)(!pte_same( * Pointer to pte entry matching* the 'address'. NULL if the page* table hasn't been allocated., Value of PTE at the time of fault ))则转到:out_nomap
3025  如果此条件成立可能性小(为编译器优化)(!PageUptodate(page))则
3026  ret等于VM_FAULT_SIGBUS
3027  转到:out_nomap
3040  inc_mm_counter_fast(The address space we belong to. , MM_ANONPAGES)
3041  dec_mm_counter_fast(The address space we belong to. , MM_SWAPENTS)
3042  pte等于Conversion functions: convert a page and protection to a page entry,* and a page entry and page directory to the page they refer to.* (Currently stuck as a macro because of indirect forward reference* to linux/mm.h:page_to_nid())(page, Access permissions of this VMA. )
3043  如果FAULT_FLAG_xxx flags 按位与Fault was a write access reuse_swap_page(page, NULL)则
3044  pte等于Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when* servicing faults for write access. In the normal case, do always want* pte_mkwrite. But get_user_pages can cause write faults for mappings
3045  FAULT_FLAG_xxx flags 与等于Fault was a write access 的反
3046  ret或等于VM_FAULT_WRITE
3047  exclusive等于flags for do_page_add_anon_rmap()
3049  flush_icache_page(vma, page)
3050  如果pte_swp_soft_dirty(Value of PTE at the time of fault )则pte等于pte_mksoft_dirty(pte)
3052  set_pte_at(The address space we belong to. , Faulting virtual address , Pointer to pte entry matching* the 'address'. NULL if the page* table hasn't been allocated., pte)
3053  Some architectures support metadata associated with a page
3054  Value of PTE at the time of fault 等于pte
3057  如果此条件成立可能性小(为编译器优化)(page != swapcache && swapcache)则
3058  page_add_new_anon_rmap(page, vma, Faulting virtual address , false)
3059  mem_cgroup_commit_charge(page, memcg, TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., false)
3060  lru_cache_add_active_or_unevictable*@page: the page to be added to LRU*@vma: vma in which page is mapped for determining reclaimability* Place @page on the active or unevictable LRU list, depending on its* evictability
3061  否则
3062  do_page_add_anon_rmap(page, vma, Faulting virtual address , exclusive)
3063  mem_cgroup_commit_charge(page, memcg, true, false)
3064  activate_page(page)
3067  swap_free(entry)
3068  如果mem_cgroup_swap_full(page)或Flags, see mm.h. 按位与VM_LOCKEDPageMlocked(page)则try_to_free_swap(page)
3071  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.
3072  如果page不等于swapcacheswapcache
3081  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.
3082  put_page(swapcache)
3085  如果FAULT_FLAG_xxx flags 按位与Fault was a write access
3086  ret或等于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
3087  如果ret按位与VM_FAULT_ERRORret与等于VM_FAULT_ERROR
3089  转到:out
3093  The x86 doesn't have any external MMU info: the kernel page* tables contain all the necessary information.
3094  unlock :
3095  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.)
3096  out :
3097  返回:ret
3098  out_nomap :
3099  mem_cgroup_cancel_charge(page, memcg, false)
3100  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.)
3101  out_page :
3102  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.
3103  out_release :
3104  put_page(page)
3105  如果page不等于swapcacheswapcache
3106  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.
3107  put_page(swapcache)
3109  返回:ret
调用者
名称描述
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)
__collapse_huge_page_swapinBring missing pages in from swap, to complete THP collapse.* Only done if khugepaged_scan_pmd believes it is worthwhile.* Called and returns without pte mapped or spinlocks held,* but with mmap_sem held to protect against vma changes.