Function report |
Source Code:mm\khugepaged.c |
Create Date:2022-07-28 16:06:57 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:khugepaged_scan_pmd
Proto:static int khugepaged_scan_pmd(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, struct page **hpage)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct mm_struct * | mm | |
| struct vm_area_struct * | vma | |
| unsigned long | address | |
| struct page ** | hpage |
| 1122 | ret = 0 , none_or_zero = 0 , result = 0 , referenced = 0 |
| 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 | If Not pmd Then |
| 1133 | result = SCAN_PMD_NULL |
| 1134 | Go to out |
| 1137 | memset(khugepaged_node_load, 0, size of khugepaged_node_load ) |
| 1139 | When _pte < pte + HPAGE_PMD_NR cycle |
| 1142 | If heck whether a pte points to a swap entry Then |
| 1143 | If ++unmapped <= khugepaged_max_ptes_swap Then |
| 1144 | Continue |
| 1145 | Else |
| 1146 | result = SCAN_EXCEED_SWAP_PTE |
| 1147 | Go to out_unmap |
| 1150 | If pte_none(pteval) || is_zero_pfn(pte_pfn(pteval)) Then |
| 1159 | If Not pte_present(pteval) Then |
| 1160 | result = SCAN_PTE_NON_PRESENT |
| 1161 | Go to out_unmap |
| 1167 | If Value for the false possibility is greater at compile time(!page) Then |
| 1168 | result = SCAN_PAGE_NULL |
| 1169 | Go to out_unmap |
| 1173 | If PageCompound(page) Then |
| 1174 | result = SCAN_PAGE_COMPOUND |
| 1175 | Go to out_unmap |
| 1184 | node = page_to_nid(page) |
| 1185 | If khugepaged_scan_abort(node) Then |
| 1186 | result = SCAN_SCAN_ABORT |
| 1187 | Go to out_unmap |
| 1189 | khugepaged_node_load[node]++ |
| 1191 | result = SCAN_PAGE_LRU |
| 1192 | Go to out_unmap |
| 1194 | If PageLocked(page) Then |
| 1195 | result = SCAN_PAGE_LOCK |
| 1196 | Go to out_unmap |
| 1199 | result = SCAN_PAGE_ANON |
| 1200 | Go to out_unmap |
| 1208 | If page_count(page) != 1 + PageSwapCache(page) Then |
| 1209 | result = SCAN_PAGE_COUNT |
| 1210 | Go to out_unmap |
| 1212 | If pte_young(pteval) || page_is_young(page) || PageReferenced(page) || mmu_notifier_test_young(The address space we belong to. , address) Then referenced++ |
| 1217 | If writable Then |
| 1218 | If referenced Then |
| 1219 | result = SCAN_SUCCEED |
| 1220 | ret = 1 |
| 1221 | Else |
| 1222 | result = SCAN_LACK_REFERENCED_PAGE |
| 1224 | Else |
| 1225 | result = SCAN_PAGE_RO |
| 1227 | out_unmap : |
| 1228 | pte_unmap_unlock(pte, ptl) |
| 1229 | If ret Then |
| 1230 | node = khugepaged_find_target_node() |
| 1232 | collapse_huge_page(mm, address, hpage, node, referenced) |
| 1234 | out : |
| 1237 | Return ret |
| Name | Describe |
|---|---|
| khugepaged_scan_mm_slot |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |