函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\vmscan.c Create Date:2022-07-27 15:41:50
Last Modify:2022-05-23 13:41:30 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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_flagsttu_flags
struct reclaim_stat *stat
boolignore_references
1090  LIST_HEAD(ret_pages)
1091  LIST_HEAD(free_pages)
1092  nr_reclaimed等于0
1093  pgactivate等于0
1095  memset(stat, 0, stat的长度)
1096  cond_resched()
1098  当非链表为空循环
1102  references等于PAGEREF_RECLAIM
1106  cond_resched()
1108  page等于lru_to_page(page_list)
1109  删除链表项
1111  如果非Return true if the page was successfully locked则转到:keep
1114  VM_BUG_ON_PAGE(PageActive(page), page)
1116  nr_pages等于Returns the number of pages in this potentially compound page.
1119  Incremented by the number of inactive pages that were scanned 加等于nr_pages
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
1127  may_enter_fs等于 This context's GFP mask 按位与__GFP_FSPageSwapCache(page)且 This context's GFP mask 按位与DOC: Reclaim modifiers* Reclaim modifiers* ~~~~~~~~~~~~~~~~~* %__GFP_IO can start physical IO.* %__GFP_FS can call down to the low-level FS. Clearing the flag avoids the* allocator recursing into the filesystem which might already be holding* locks.
1136  Check if a page is dirty or under writeback
1137  如果dirtywritebacknr_dirty自加
1140  如果dirty且非writebacknr_unqueued_dirty自加
1149  mapping等于page_mapping(page)
1150  如果dirtywriteback的值且mappinginode_write_congested(host)或writebackPG_readahead is only used for reads; PG_reclaim is only for writes nr_congested自加
1202  nr_immediate自加
1203  转到:activate_locked
1224  否则
1233  如果非ignore_referencesreferences等于page_check_references(page, sc)
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)则
1284  may_enter_fs等于1
1287  mapping等于page_mapping(page)
1304  nr_pages等于1
1311  如果page_mapped(page)则
1316  如果非try_to_unmap(page, flags)则
1317  nr_unmap_fail加等于nr_pages
1318  转到:activate_locked
1322  如果PageDirty(page)则
1348  如果references恒等于PAGEREF_RECLAIM_CLEAN则转到:keep_locked
1350  如果非may_enter_fs则转到:keep_locked
1363  转到:keep_locked
1365  转到:activate_locked
1407  如果页面私有占用
1410  如果非mappingpage_count(page)恒等于1则
1428  如果PageAnon(page)且非PageSwapBacked(page)则
1430  如果非page_ref_freeze(page, 1)则转到:keep_locked
1432  如果PageDirty(page)则
1433  page_ref_unfreeze(page, 1)
1434  转到:keep_locked
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
1443  lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
1444  free_it :
1449  nr_reclaimed加等于nr_pages
1455  如果此条件成立可能性小(为编译器优化)(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)则( * get_compound_page_dtor(page))(page)
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)则
1479  nr_activate[type]加等于nr_pages
1482  keep_locked :
1483  lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
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_listshrink_inactive_list() is a helper for shrink_node(). It returns the number* of reclaimed pages
reclaim_pages