函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:shrink_lruvec

函数原型:static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)

返回类型:void

参数:

类型参数名称
struct lruvec *lruvec
struct scan_control *sc
2464  nr_reclaimed等于0
2465  nr_to_reclaim等于 How many pages shrink_list() should reclaim
2469  Determine how aggressively the anon and file LRU lists should be* scanned
2472  内存复制(targets, nr, nr的长度)
2485  scan_adjusted等于非cgroup_reclaim(sc)且非current_is_kswapd()且 Scan (total_size >> priority) pages at once 恒等于The "priority" of VM scanning is how much of the queues we will scan in one* go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the* queues ("queue_length >> 12") during an aging round.
2488  blk_start_plug( & plug)
2489 nr[LRU_INACTIVE_ANON]或nr[LRU_ACTIVE_FILE]或nr[LRU_INACTIVE_FILE]循环
2495  如果nr[lru]则
2497  nr[lru]减等于nr_to_scan
2504  cond_resched()
2506  如果nr_reclaimed小于nr_to_reclaimscan_adjusted则继续下一循环
2516  nr_file等于nr[LRU_INACTIVE_FILE]加nr[LRU_ACTIVE_FILE]
2517  nr_anon等于nr[LRU_INACTIVE_ANON]加nr[LRU_ACTIVE_ANON]
2525  如果非nr_file或非nr_anon退出
2528  如果nr_file大于nr_anon
2529  scan_target等于targets[LRU_INACTIVE_ANON]加targets[LRU_ACTIVE_ANON]加1
2531  lru等于We do arithmetic on the LRU lists in various places in the code,* so it is important to keep the active lists LRU_ACTIVE higher in* the array than the corresponding inactive lists, and to keep
2532  percentage等于nr_anon乘100除scan_target
2533  否则
2534  scan_target等于targets[LRU_INACTIVE_FILE]加targets[LRU_ACTIVE_FILE]加1
2536  lru等于LRU_FILE
2537  percentage等于nr_file乘100除scan_target
2541  nr[lru]等于0
2542  nr[lru + LRU_ACTIVE]等于0
2548  lru等于如果lru恒等于LRU_FILEWe do arithmetic on the LRU lists in various places in the code,* so it is important to keep the active lists LRU_ACTIVE higher in* the array than the corresponding inactive lists, and to keep否则LRU_FILE
2549  nr_scanned等于targets[lru]减nr[lru]
2550  nr[lru]等于targets[lru]乘100减percentage的差除100
2551  nr[lru]减等于两数取小(nr[lru], nr_scanned)
2553  lru加等于LRU_ACTIVE
2554  nr_scanned等于targets[lru]减nr[lru]
2555  nr[lru]等于targets[lru]乘100减percentage的差除100
2556  nr[lru]减等于两数取小(nr[lru], nr_scanned)
2558  scan_adjusted = true
2560  blk_finish_plug( & plug)
2561  Number of pages freed so far during a call to shrink_zones() 加等于nr_reclaimed
2567  如果total_swap_pagesThe inactive anon list should be small enough that the VM never has* to do too much work.* The inactive file list should be small enough to leave most memory* to the established workingset on the scan-resistant active list,shrink_active_list(SWAP_CLUSTER_MAX, lruvec, sc, LRU_ACTIVE_ANON)
调用者
名称描述
shrink_node_memcgs
mem_cgroup_shrink_nodeOnly used by soft limit reclaim. Do not reuse for anything else.