函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\huge_memory.c Create Date:2022-07-27 17:37:15
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

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

函数原型:int page_trans_huge_mapcount(struct page *page, int *total_mapcount)

返回类型:int

参数:

类型参数名称
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  如果此条件成立可能性大(为编译器优化)(!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.)则
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  如果total_mapcounttotal_mapcount等于mapcount
2638  返回:mapcount
2641  page等于compound_head(page)
2643  _total_mapcount等于ret等于0
2644 i小于HPAGE_PMD_NR循环
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等于两数取大(ret, mapcount)
2647  _total_mapcount加等于mapcount
2649  如果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)
2650  ret减等于1
2651  _total_mapcount减等于HPAGE_PMD_NR
2653  mapcount等于compound_mapcount(page)
2654  ret加等于mapcount
2655  _total_mapcount加等于mapcount
2656  如果total_mapcounttotal_mapcount等于_total_mapcount
2658  返回:ret