函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Special version of the above for do_swap_page, which often runs* into pages that are exclusively owned by the current process.* Everybody else should continue to use page_add_anon_rmap above.

函数原型:void do_page_add_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address, int flags)

返回类型:void

参数:

类型参数名称
struct page *page
struct vm_area_struct *vma
unsigned longaddress
intflags
1121  compound等于flags按位与RMAP_COMPOUND
1124  如果compound
1126  VM_BUG_ON_PAGE(!PageLocked(page), page)
1127  VM_BUG_ON_PAGE(!PageHuge() only returns true for hugetlbfs pages, but not for* normal or transparent huge pages.* PageTransHuge() returns true for both transparent huge and* hugetlbfs pages, but not normal pages. PageTransHuge() can only be, page)
1128  mapcount等于compound_mapcount_ptr(page)
1129  first等于atomic_inc_and_test(mapcount)
1130  否则
1131  first等于atomic_inc_and_test( & * If the page can be mapped to userspace, encodes the number * of times this page is referenced by a page table.)
1134  如果first
1135  nr等于如果compoundhpage_nr_pages(page)否则1
1142  如果compound__inc_node_page_state(page, NR_ANON_THPS)
1144  __mod_node_page_state(page_pgdat(page), Mapped anonymous pages , nr)
1146  如果此条件成立可能性小(为编译器优化)(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)则返回
1149  VM_BUG_ON_PAGE(!PageLocked(page), page)
1152  如果first__page_set_anon_rmap - set up new anonymous rmap*@page: Page or Hugepage to add to rmap*@vma: VM area to add page to.*@address: User virtual address of the mapping *@exclusive: the page is exclusively owned by the current process
1155  否则__page_check_anon_rmap - sanity check anonymous rmap addition*@page: the page to add the mapping to*@vma: the vm area in which the mapping is added*@address: the user virtual address mapped
调用者
名称描述
page_add_anon_rmappage_add_anon_rmap - add pte mapping to an anonymous page*@page: the page to add the mapping to*@vma: the vm area in which the mapping is added*@address: the user virtual address mapped*@compound: charge the page as compound or small page* The caller
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