函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:page_trans_huge_map_swapcount

函数原型:static int page_trans_huge_map_swapcount(struct page *page, int *total_mapcount, int *total_swapcount)

返回类型:int

参数:

类型参数名称
struct page *page
int *total_mapcount
int *total_swapcount
1585  offset等于0
1587  struct swap_cluster_info * ci = NULL
1588  unsigned char * map = NULL
1589  swapcount等于0
1592  VM_BUG_ON_PAGE(PageHuge(page), page)
1594  如果非IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_THP_SWAP)或此条件成立可能性大(为编译器优化)(!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.)则
1595  mapcount等于page_trans_huge_mapcount(page, total_mapcount)
1596  如果PageSwapCache(page)则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.
1598  如果total_swapcounttotal_swapcount等于swapcount
1600  返回:mapcountswapcount
1603  page等于compound_head(page)
1605  _total_mapcount等于_total_swapcount等于map_swapcount等于0
1606  如果PageSwapCache(page)则
1609  val等于page_private(page)
1610  si等于_swap_info_get(entry)
1611  如果si
1616  如果mapci等于lock_cluster(si, offset)
1618 i小于HPAGE_PMD_NR循环
1619  mapcount等于atomic_read( & * If the page can be mapped to userspace, encodes the number * of times this page is referenced by a page table.)加1
1620  _total_mapcount加等于mapcount
1621  如果map
1622  swapcount等于swap_count(map[offset + i])
1623  _total_swapcount加等于swapcount
1625  map_swapcount等于两数取大(map_swapcount, mapcount + swapcount)
1627  unlock_cluster(ci)
1628  如果PageDoubleMap indicates that the compound page is mapped with PTEs as well* as PMDs.* This is required for optimization of rmap operations for THP: we can postpone* per small page mapcount accounting (and its overhead from atomic operations)
1629  map_swapcount减等于1
1630  _total_mapcount减等于HPAGE_PMD_NR
1632  mapcount等于compound_mapcount(page)
1633  map_swapcount加等于mapcount
1634  _total_mapcount加等于mapcount
1635  如果total_mapcounttotal_mapcount等于_total_mapcount
1637  如果total_swapcounttotal_swapcount等于_total_swapcount
1640  返回:map_swapcount
调用者
名称描述
reuse_swap_pageWe 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