函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:khugepaged_scan_pmd

函数原型:static int khugepaged_scan_pmd(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, struct page **hpage)

返回类型:int

参数:

类型参数名称
struct mm_struct *mm
struct vm_area_struct *vma
unsigned longaddress
struct page **hpage
1122  ret等于0, none_or_zero等于0, result等于0, referenced等于0
1123  struct page * page = NULL
1126  node等于NUMA_NO_NODE, unmapped等于0
1127  bool writable = false
1129  VM_BUG_ON(address & ~HPAGE_PMD_MASK)
1131  pmd等于mm_find_pmd(mm, address)
1132  如果非pmd
1133  result等于SCAN_PMD_NULL
1134  转到:out
1137  memset(khugepaged_node_load, 0, khugepaged_node_load的长度)
1138  pte等于pte_offset_map_lock(mm, pmd, address, & ptl)
1139 _pte小于pteHPAGE_PMD_NR循环
1141  pteval等于_pte
1143  如果unmapped先自加小于等于khugepaged_max_ptes_swap
1144  继续下一循环
1145  否则
1147  转到:out_unmap
1150  如果pte_none(pteval)或is_zero_pfn(pte_pfn(pteval))则
1153  继续下一循环
1154  否则
1156  转到:out_unmap
1159  如果非pte_present(pteval)则
1161  转到:out_unmap
1163  如果pte_write(pteval)则writable = true
1166  page等于vm_normal_page -- This function gets the "struct page" associated with a pte.* "Special" mappings do not wish to be associated with a "struct page" (either* it doesn't exist, or it exists but they don't want to touch it). In this
1168  result等于SCAN_PAGE_NULL
1169  转到:out_unmap
1173  如果PageCompound(page)则
1175  转到:out_unmap
1184  node等于page_to_nid(page)
1185  如果khugepaged_scan_abort(node)则
1186  result等于SCAN_SCAN_ABORT
1187  转到:out_unmap
1189  khugepaged_node_load[node]自加
1190  如果非PageLRU(page)则
1191  result等于SCAN_PAGE_LRU
1192  转到:out_unmap
1194  如果PageLocked(page)则
1195  result等于SCAN_PAGE_LOCK
1196  转到:out_unmap
1198  如果非PageAnon(page)则
1199  result等于SCAN_PAGE_ANON
1200  转到:out_unmap
1208  如果page_count(page)不等于1加PageSwapCache(page)则
1209  result等于SCAN_PAGE_COUNT
1210  转到:out_unmap
1212  如果pte_young(pteval)或page_is_young(page)或PageReferenced(page)或mmu_notifier_test_young(The address space we belong to. , address)则referenced自加
1217  如果writable
1218  如果referenced
1219  result等于SCAN_SUCCEED
1220  ret等于1
1221  否则
1224  否则
1225  result等于SCAN_PAGE_RO
1227  out_unmap :
1228  pte_unmap_unlock(pte, ptl)
1229  如果ret
1230  node等于khugepaged_find_target_node()
1232  collapse_huge_page(mm, address, hpage, node, referenced)
1234  out :
1235  trace_mm_khugepaged_scan_pmd(mm, page, writable, referenced, none_or_zero, result, unmapped)
1237  返回:ret
调用者
名称描述
khugepaged_scan_mm_slot