Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:We can write to an anon page without COW if there are no other references* to it. And as a side-effect, free up its swap: because the old content* on disk will never be read, and seeking back there to write new content

Proto:bool reuse_swap_page(struct page *page, int *total_map_swapcount)

Type:bool

Parameter:

TypeParameterName
struct page *page
int *total_map_swapcount
1657  VM_BUG_ON_PAGE(!PageLocked(page), page)
1658  If Value for the false possibility is greater at compile time(A KSM page is one of those write-protected "shared pages" or "merged pages"* which KSM maps into multiple mms, wherever identical anonymous page content* is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any) Then Return false
1660  count = page_trans_huge_map_swapcount(page, & total_mapcount, & total_swapcount)
1662  If total_map_swapcount Then total_map_swapcount = total_mapcount + total_swapcount
1664  If count == 1 && PageSwapCache(page) && (Value is more likely to compile time(!PageTransCompound returns true for both transparent huge pages* and hugetlbfs pages, so it should only be called when it's known* that hugetlbfs pages aren't involved.) || total_swapcount == How many references to page are currently swapped out?* This does not give an exact answer when swap count is continued,* but does include the high COUNT_CONTINUED flag to allow for that. ) Then
1669  page = compound_head(page)
1671  SetPageDirty(page)
1672  Else
1676  val = page_private(page)
1677  p = swap_info_get(entry)
1686  Return count <= 1
Caller
NameDescribe
do_wp_pageThis 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
do_swap_pageWe 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