Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\vmscan.c Create Date:2022-07-28 14:19:00
Last Modify:2022-05-23 13:41:30 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:shrink_lruvec

Proto:static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)

Type:void

Parameter:

TypeParameterName
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  No 3D Now!(targets, nr, size of nr )
2485  scan_adjusted = Not cgroup_reclaim(sc) && Not 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  When nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] || nr[LRU_INACTIVE_FILE] cycle
2495  If nr[lru] Then
2497  nr[lru] -= nr_to_scan
2504  cond_resched()
2506  If nr_reclaimed < nr_to_reclaim || scan_adjusted Then Continue
2516  nr_file = nr[LRU_INACTIVE_FILE] + nr[LRU_ACTIVE_FILE]
2517  nr_anon = nr[LRU_INACTIVE_ANON] + nr[LRU_ACTIVE_ANON]
2525  If Not nr_file || Not nr_anon Then Break
2528  If nr_file > nr_anon Then
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  Else
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 = If lru == LRU_FILE Then 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 Else LRU_FILE
2549  nr_scanned = targets[lru] - nr[lru]
2550  nr[lru] = targets[lru] * (100 - percentage) / 100
2551  nr[lru] -= min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(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] -= min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(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  If total_swap_pages && The 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, Then shrink_active_list(SWAP_CLUSTER_MAX, lruvec, sc, LRU_ACTIVE_ANON)
Caller
NameDescribe
shrink_node_memcgs
mem_cgroup_shrink_nodeOnly used by soft limit reclaim. Do not reuse for anything else.