函数逻辑报告 |
Source Code:mm\vmscan.c |
Create Date:2022-07-27 15:41:50 |
Last Modify:2022-05-23 13:41:30 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:shrink_page_list() returns the number of reclaimed pages
函数原型: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)
返回类型:unsigned long
参数:
类型 | 参数 | 名称 |
---|---|---|
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) |
1109 | 删除链表项 |
1114 | VM_BUG_ON_PAGE(PageActive(page), page) |
1121 | 如果此条件成立可能性小(为编译器优化)(!page_evictable - test whether a page is evictable*@page: the page to test* Test whether page is evictable--i)则转到:activate_locked |
1124 | 如果非 Can mapped pages be reclaimed? 且page_mapped(page)则转到:keep_locked |
1140 | 如果dirty且非writeback则nr_unqueued_dirty自加 |
1149 | mapping等于page_mapping(page) |
1150 | 如果dirty或writeback的值且mapping且inode_write_congested(host)或writeback且PG_readahead is only used for reads; PG_reclaim is only for writes 则nr_congested自加 |
1202 | nr_immediate自加 |
1203 | 转到:activate_locked |
1220 | nr_writeback自加 |
1221 | 转到:activate_locked |
1224 | 否则 |
1228 | 添加链表项 |
1229 | 继续下一循环 |
1233 | 如果非ignore_references则references等于page_check_references(page, sc) |
1237 | 当:references恒等于PAGEREF_ACTIVATE |
1238 | 转到:activate_locked |
1239 | 当:references恒等于PAGEREF_KEEP |
1240 | nr_ref_keep加等于nr_pages |
1241 | 转到:keep_locked |
1242 | 当:references恒等于PAGEREF_RECLAIM |
1243 | 当:references恒等于PAGEREF_RECLAIM_CLEAN |
1252 | 如果PageAnon(page)且PageSwapBacked(page)则 |
1253 | 如果非PageSwapCache(page)则 |
1258 | 如果非can_split_huge_page(page, NULL)则转到:activate_locked |
1278 | Disable counters |
1284 | may_enter_fs等于1 |
1287 | mapping等于page_mapping(page) |
1304 | nr_pages等于1 |
1311 | 如果page_mapped(page)则 |
1312 | flags等于ttu_flags按位或 Batch TLB flushes where possible * and caller guarantees they will * do a final flush if necessary |
1316 | 如果非try_to_unmap(page, flags)则 |
1317 | nr_unmap_fail加等于nr_pages |
1318 | 转到:activate_locked |
1345 | 转到:activate_locked |
1348 | 如果references恒等于PAGEREF_RECLAIM_CLEAN则转到:keep_locked |
1350 | 如果非may_enter_fs则转到:keep_locked |
1360 | try_to_unmap_flush_dirty() |
1363 | 转到:keep_locked |
1365 | 转到:activate_locked |
1367 | 如果Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting.则转到:keep |
1378 | 如果PageDirty(page)或Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting.则转到:keep_locked |
1380 | mapping等于page_mapping(page) |
1407 | 如果页面私有占用则 |
1410 | 如果非mapping且page_count(page)恒等于1则 |
1414 | 否则 |
1422 | nr_reclaimed自加 |
1423 | 继续下一循环 |
1428 | 如果PageAnon(page)且非PageSwapBacked(page)则 |
1430 | 如果非page_ref_freeze(page, 1)则转到:keep_locked |
1433 | page_ref_unfreeze(page, 1) |
1434 | 转到:keep_locked |
1437 | Disable counters |
1439 | 否则如果非mapping或非Same as remove_mapping, but if the page is removed from the mapping, it* gets returned with a refcount of 0.则转到:keep_locked |
1444 | free_it : |
1449 | nr_reclaimed加等于nr_pages |
1457 | 否则添加链表项 |
1459 | 继续下一循环 |
1461 | activate_locked_split : |
1466 | 如果nr_pages大于1则 |
1468 | nr_pages等于1 |
1470 | activate_locked : |
1472 | 如果PageSwapCache(page)且mem_cgroup_swap_full(page)或PageMlocked(page)的值则try_to_free_swap(page) |
1475 | VM_BUG_ON_PAGE(PageActive(page), page) |
1476 | 如果非PageMlocked(page)则 |
1478 | SetPageActive(page) |
1479 | nr_activate[type]加等于nr_pages |
1480 | count_memcg_page_event(page, PGACTIVATE) |
1482 | keep_locked : |
1484 | keep : |
1485 | 添加链表项 |
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) |
1495 | 为栈加入第二个链表项 |
1496 | count_vm_events(PGACTIVATE, pgactivate) |
1498 | 返回:nr_reclaimed |
名称 | 描述 |
---|---|
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 |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |