Function report |
Source Code:mm\vmscan.c |
Create Date:2022-07-28 14:17:56 |
| Last Modify:2022-05-23 13:41:30 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:shrink_page_list() returns the number of reclaimed pages
Proto:static unsigned long shrink_page_list(struct list_head *page_list, struct pglist_data *pgdat, struct scan_control *sc, enum ttu_flags ttu_flags, struct reclaim_stat *stat, bool ignore_references)
Type:unsigned long
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct list_head * | page_list | |
| struct pglist_data * | pgdat | |
| struct scan_control * | sc | |
| enum ttu_flags | ttu_flags | |
| struct reclaim_stat * | stat | |
| bool | ignore_references |
| 1091 | LIST_HEAD(free_pages) |
| 1092 | nr_reclaimed = 0 |
| 1093 | pgactivate = 0 |
| 1096 | cond_resched() |
| 1102 | references = PAGEREF_RECLAIM |
| 1106 | cond_resched() |
| 1108 | page = lru_to_page(page_list) |
| 1111 | If Not Return true if the page was successfully locked Then Go to keep |
| 1114 | VM_BUG_ON_PAGE(PageActive(page), page) |
| 1124 | If Not Can mapped pages be reclaimed? && page_mapped(page) Then Go to keep_locked |
| 1140 | If dirty && Not writeback Then nr_unqueued_dirty++ |
| 1149 | mapping = page_mapping(page) |
| 1150 | If (dirty || writeback) && mapping && inode_write_congested(host) || writeback && PG_readahead is only used for reads; PG_reclaim is only for writes Then nr_congested++ |
| 1202 | nr_immediate++ |
| 1203 | Go to activate_locked |
| 1220 | nr_writeback++ |
| 1221 | Go to activate_locked |
| 1224 | Else |
| 1229 | Continue |
| 1233 | If Not ignore_references Then references = page_check_references(page, sc) |
| 1237 | Case references == PAGEREF_ACTIVATE |
| 1238 | Go to activate_locked |
| 1239 | Case references == PAGEREF_KEEP |
| 1240 | nr_ref_keep += nr_pages |
| 1241 | Go to keep_locked |
| 1242 | Case references == PAGEREF_RECLAIM |
| 1243 | Case references == PAGEREF_RECLAIM_CLEAN |
| 1252 | If PageAnon(page) && PageSwapBacked(page) Then |
| 1253 | If Not PageSwapCache(page) Then |
| 1258 | If Not can_split_huge_page(page, NULL) Then Go to activate_locked |
| 1278 | Disable counters |
| 1284 | may_enter_fs = 1 |
| 1287 | mapping = page_mapping(page) |
| 1304 | nr_pages = 1 |
| 1311 | If page_mapped(page) Then |
| 1312 | flags = ttu_flags | Batch TLB flushes where possible * and caller guarantees they will * do a final flush if necessary |
| 1316 | If Not try_to_unmap(page, flags) Then |
| 1317 | nr_unmap_fail += nr_pages |
| 1318 | Go to activate_locked |
| 1345 | Go to activate_locked |
| 1348 | If references == PAGEREF_RECLAIM_CLEAN Then Go to keep_locked |
| 1350 | If Not may_enter_fs Then Go to keep_locked |
| 1352 | If Not Writepage batching in laptop mode; RECLAIM_WRITE Then Go to keep_locked |
| 1360 | try_to_unmap_flush_dirty() |
| 1363 | Go to keep_locked |
| 1365 | Go to activate_locked |
| 1367 | If Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting. Then Go to keep |
| 1376 | If Not Return true if the page was successfully locked Then Go to keep |
| 1378 | If PageDirty(page) || Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting. Then Go to keep_locked |
| 1380 | mapping = page_mapping(page) |
| 1410 | If Not mapping && page_count(page) == 1 Then |
| 1412 | If Drop a ref, return true if the refcount fell to zero (the page has no users) Then Go to free_it |
| 1414 | Else |
| 1422 | nr_reclaimed++ |
| 1423 | Continue |
| 1428 | If PageAnon(page) && Not PageSwapBacked(page) Then |
| 1430 | If Not page_ref_freeze(page, 1) Then Go to keep_locked |
| 1433 | page_ref_unfreeze(page, 1) |
| 1434 | Go to keep_locked |
| 1437 | Disable counters |
| 1439 | Else if Not mapping || Not Same as remove_mapping, but if the page is removed from the mapping, it* gets returned with a refcount of 0. Then Go to keep_locked |
| 1444 | free_it : |
| 1449 | nr_reclaimed += nr_pages |
| 1459 | Continue |
| 1461 | activate_locked_split : |
| 1466 | If nr_pages > 1 Then |
| 1468 | nr_pages = 1 |
| 1470 | activate_locked : |
| 1472 | If PageSwapCache(page) && (mem_cgroup_swap_full(page) || PageMlocked(page)) Then try_to_free_swap(page) |
| 1475 | VM_BUG_ON_PAGE(PageActive(page), page) |
| 1476 | If Not PageMlocked(page) Then |
| 1478 | SetPageActive(page) |
| 1479 | nr_activate[type] += nr_pages |
| 1480 | count_memcg_page_event(page, PGACTIVATE) |
| 1482 | keep_locked : |
| 1484 | keep : |
| 1486 | VM_BUG_ON_PAGE(PageLRU(page) || PageUnevictable(page), page) |
| 1489 | pgactivate = nr_activate[0] + nr_activate[1] |
| 1491 | mem_cgroup_uncharge_list( & free_pages) |
| 1492 | try_to_unmap_flush() |
| 1493 | free_unref_page_list( & free_pages) |
| 1496 | count_vm_events(PGACTIVATE, pgactivate) |
| 1498 | Return nr_reclaimed |
| Name | Describe |
|---|---|
| reclaim_clean_pages_from_list | |
| shrink_inactive_list | shrink_inactive_list() is a helper for shrink_node(). It returns the number* of reclaimed pages |
| reclaim_pages |
| 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 |