函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:No need to decide whether this PTE shares the swap entry with others,* just let do_wp_page work it out if a write is requested later - to* force COW, vm_page_prot omits write permission from any private vma.

函数原型:static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd, unsigned long addr, swp_entry_t entry, struct page *page)

返回类型:int

参数:

类型参数名称
struct vm_area_struct *vma
pmd_t *pmd
unsigned longaddr
swp_entry_tentry
struct page *page
1860  ret等于1
1862  swapcache等于page
1863  page等于ksm_might_need_to_copy(page, vma, addr)
1864  如果此条件成立可能性小(为编译器优化)(!page)则返回:负ENOMEM
1867  如果mem_cgroup_try_charge(page, The address space we belong to. , GFP_KERNEL, & memcg, false)则
1869  ret等于负ENOMEM
1870  转到:out_nolock
1873  pte等于pte_offset_map_lock(The address space we belong to. , pmd, addr, & ptl)
1874  如果此条件成立可能性小(为编译器优化)(!pte_same_as_swp( * pte, Convert the arch-independent representation of a swp_entry_t into the* arch-dependent pte representation.))则
1875  mem_cgroup_cancel_charge(page, memcg, false)
1876  ret等于0
1877  转到:out
1880  dec_mm_counter(The address space we belong to. , MM_SWAPENTS)
1881  inc_mm_counter(The address space we belong to. , MM_ANONPAGES)
1882  get_page(page)
1883  set_pte_at(The address space we belong to. , addr, pte, pte_mkold(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. )))
1885  如果page恒等于swapcache
1886  page_add_anon_rmap - add pte mapping to an anonymous page*@page: the page to add the mapping to*@vma: the vm area in which the mapping is added*@address: the user virtual address mapped*@compound: charge the page as compound or small page* The caller
1887  mem_cgroup_commit_charge(page, memcg, true, false)
1888  否则
1889  page_add_new_anon_rmap - add pte mapping to a new anonymous page*@page: the page to add the mapping to*@vma: the vm area in which the mapping is added*@address: the user virtual address mapped*@compound: charge the page as compound or small page
1890  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)
1891  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
1893  Caller has made sure that the swap device corresponding to entry* is still around or has not been recycled.
1898  activate_page(page)
1899  out :
1900  pte_unmap_unlock(pte, ptl)
1901  out_nolock :
1902  如果page不等于swapcache
1903  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.
1904  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
1906  返回:ret
调用者
名称描述
unuse_pte_range