Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\swapfile.c Create Date:2022-07-28 15:18:18
Last Modify:2020-03-17 22:19:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:unuse_pte_range

Proto: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)

Type:int

Parameter:

TypeParameterName
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  Do
1927  If Not heck whether a pte points to a swap entry Then Continue
1930  entry = Convert the arch-dependent pte representation of a swp_entry_t into an* arch-independent swp_entry_t.
1931  If Extract the `type' field from a swp_entry_t. The swp_entry_t is in* arch-independent format != type Then Continue
1934  offset = Extract the `offset' field from a swp_entry_t. The swp_entry_t is in* arch-independent format
1935  If frontswap && Not frontswap_test(si, offset) Then Continue
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  If Not page Then
1947  Return -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  If ret < 0 Then
1956  Go to 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  If fs_pages_to_unuse && Not --fs_pages_to_unuse Then
1965  Go to out
1967  try_next :
1968  pte = pte_offset_map(pmd, addr)
1969  When pte++, addr += PAGE_SIZE , addr != end cycle
1970  pte_unmap(pte - 1)
1972  ret = 0
1973  out :
1974  Return ret
Caller
NameDescribe
unuse_pmd_range