函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:unuse_pte_range

函数原型:static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd, unsigned long addr, unsigned long end, unsigned int type, bool frontswap, unsigned long *fs_pages_to_unuse)

返回类型:int

参数:

类型参数名称
struct vm_area_struct *vma
pmd_t *pmd
unsigned longaddr
unsigned longend
unsigned inttype
boolfrontswap
unsigned long *fs_pages_to_unuse
1919  ret等于0
1922  si等于swap_info[type]
1923  pte等于pte_offset_map(pmd, addr)
1924  循环
1927  如果非heck whether a pte points to a swap entry 则继续下一循环
1930  entry等于Convert the arch-dependent pte representation of a swp_entry_t into an* arch-independent swp_entry_t.
1931  如果Extract the `type' field from a swp_entry_t. The swp_entry_t is in* arch-independent format不等于type则继续下一循环
1934  offset等于Extract the `offset' field from a swp_entry_t. The swp_entry_t is in* arch-independent format
1935  如果frontswap且非frontswap_test(si, offset)则继续下一循环
1938  pte_unmap(pte)
1939  swap_map等于vmalloc'ed array of usage counts [offset]
1940  Target VMA 等于vma
1941  Faulting virtual address 等于addr
1942  Pointer to pmd entry matching* the 'address' 等于pmd
1943  page等于swapin_readahead - swap in pages in hope we need them soon*@entry: swap entry of this memory*@gfp_mask: memory allocation flags*@vmf: fault information* Returns the struct page for entry and addr, after queueing swapin.
1944  如果非page
1945  如果swap_map恒等于0或swap_map恒等于Note pageblock is bad, in first swap_map 则转到:try_next
1947  返回:负ENOMEM
1950  lock_page may only be called if we have the page's inode pinned.
1951  Wait for a page to complete writeback
1952  ret等于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.
1953  如果ret小于0则
1956  转到:out
1959  If swap is getting full, or if there are no more mappings of this page,* then try_to_free_swap is called to free its swap space.
1960  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.
1961  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
1963  如果fs_pages_to_unuse且非fs_pages_to_unuse先自减则
1965  转到:out
1967  try_next :
1968  pte等于pte_offset_map(pmd, addr)
1969 pte自加, addr加等于PAGE_SIZE, addr不等于end循环
1970  pte_unmap(pte - 1)
1972  ret等于0
1973  out :
1974  返回:ret
调用者
名称描述
unuse_pmd_range