Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\huge_memory.c Create Date:2022-07-28 16:03:05
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:This calculates accurately how many mappings a transparent hugepage* has (unlike page_mapcount() which isn't fully accurate)

Proto:int page_trans_huge_mapcount(struct page *page, int *total_mapcount)

Type:int

Parameter:

TypeParameterName
struct page *page
int *total_mapcount
2632  VM_BUG_ON_PAGE(PageHuge() only returns true for hugetlbfs pages, but not for normal or* transparent huge pages. See the PageTransHuge() documentation for more* details., page)
2634  If 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.) Then
2635  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
2636  If total_mapcount Then total_mapcount = mapcount
2638  Return mapcount
2641  page = compound_head(page)
2643  _total_mapcount = ret = 0
2644  When i < HPAGE_PMD_NR cycle
2645  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
2646  ret = max - return maximum of two values of the same or compatible types*@x: first value*@y: second value(ret, mapcount)
2647  _total_mapcount += mapcount
2649  If 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) Then
2650  ret -= 1
2651  _total_mapcount -= HPAGE_PMD_NR
2653  mapcount = compound_mapcount(page)
2654  ret += mapcount
2655  _total_mapcount += mapcount
2656  If total_mapcount Then total_mapcount = _total_mapcount
2658  Return ret