函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Determine how aggressively the anon and file LRU lists should be* scanned

函数原型:static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, unsigned long *nr)

返回类型:void

参数:

类型参数名称
struct lruvec *lruvec
struct scan_control *sc
unsigned long *nr
2247  memcg等于lruvec_memcg(lruvec)
2248  swappiness等于mem_cgroup_swappiness(memcg)
2249  reclaim_stat等于reclaim_stat
2251  denominator等于0
2252  pgdat等于lruvec_pgdat(lruvec)
2260  如果非 Can pages be swapped as part of reclaim? mem_cgroup_get_nr_swap_pages(memcg)小于等于0则
2261  scan_balance等于SCAN_FILE
2262  转到:out
2272  如果cgroup_reclaim(sc)且非swappiness
2273  scan_balance等于SCAN_FILE
2274  转到:out
2282  如果非 Scan (total_size >> priority) pages at once swappiness
2283  scan_balance等于SCAN_EQUAL
2284  转到:out
2290  如果 The file pages on the current node are dangerously low
2291  scan_balance等于SCAN_ANON
2292  转到:out
2299  如果 There is easily reclaimable cold cache in the current node
2300  scan_balance等于SCAN_FILE
2301  转到:out
2304  scan_balance等于SCAN_FRACT
2310  anon_prio等于swappiness
2311  file_prio等于200减anon_prio
2325  anon等于lruvec_lru_size - Returns the number of pages on the given LRU list.*@lruvec: lru vector*@lru: lru to use*@zone_idx: zones to consider (use MAX_NR_ZONES for the whole LRU list)lruvec_lru_size - Returns the number of pages on the given LRU list.*@lruvec: lru vector*@lru: lru to use*@zone_idx: zones to consider (use MAX_NR_ZONES for the whole LRU list)
2327  file等于lruvec_lru_size - Returns the number of pages on the given LRU list.*@lruvec: lru vector*@lru: lru to use*@zone_idx: zones to consider (use MAX_NR_ZONES for the whole LRU list)lruvec_lru_size - Returns the number of pages on the given LRU list.*@lruvec: lru vector*@lru: lru to use*@zone_idx: zones to consider (use MAX_NR_ZONES for the whole LRU list)
2330  spin_lock_irq( & Write-intensive fields used by page reclaim )
2331  如果此条件成立可能性小(为编译器优化)(recent_scanned[0] > anon / 4)则
2332  recent_scanned[0]除等于2
2333  * The pageout code in vmscan.c keeps track of how many of the * mem/swap backed and file backed pages are referenced. * The higher the rotated/scanned ratio, the more valuable * that cache is. * The anon LRU stats live in [0], file LRU stats in [1][0]除等于2
2336  如果此条件成立可能性小(为编译器优化)(recent_scanned[1] > file / 4)则
2337  recent_scanned[1]除等于2
2338  * The pageout code in vmscan.c keeps track of how many of the * mem/swap backed and file backed pages are referenced. * The higher the rotated/scanned ratio, the more valuable * that cache is. * The anon LRU stats live in [0], file LRU stats in [1][1]除等于2
2346  ap等于anon_priorecent_scanned[0]加1的和
2347  ap除等于* The pageout code in vmscan.c keeps track of how many of the * mem/swap backed and file backed pages are referenced. * The higher the rotated/scanned ratio, the more valuable * that cache is. * The anon LRU stats live in [0], file LRU stats in [1][0]加1
2349  fp等于file_priorecent_scanned[1]加1的和
2350  fp除等于* The pageout code in vmscan.c keeps track of how many of the * mem/swap backed and file backed pages are referenced. * The higher the rotated/scanned ratio, the more valuable * that cache is. * The anon LRU stats live in [0], file LRU stats in [1][1]加1
2351  spin_unlock_irq( & Write-intensive fields used by page reclaim )
2353  fraction[0]等于ap
2354  fraction[1]等于fp
2355  denominator等于apfp加1
2356  out :
2358  file等于is_file_lru(lru)
2363  lruvec_size等于lruvec_lru_size - Returns the number of pages on the given LRU list.*@lruvec: lru vector*@lru: lru to use*@zone_idx: zones to consider (use MAX_NR_ZONES for the whole LRU list)
2364  protection等于mem_cgroup_protection(memcg, * Cgroups are not reclaimed below their configured memory.low, * unless we threaten to OOM. If any cgroups are skipped due to * memory.low and nothing was reclaimed, go back for memory.low.)
2367  如果protection
2397  cgroup_size等于mem_cgroup_size(memcg)
2400  cgroup_size等于两数取大(cgroup_size, protection)
2402  scan等于lruvec_sizelruvec_sizeprotectioncgroup_size
2410  scan等于两数取大(scan, SWAP_CLUSTER_MAX)
2411  否则
2412  scan等于lruvec_size
2415  scan右移等于 Scan (total_size >> priority) pages at once
2421  如果非scan且非mem_cgroup_online(memcg)则scan等于两数取小(lruvec_size, SWAP_CLUSTER_MAX)
2425  :scan_balance恒等于SCAN_EQUAL
2427  退出
2428  :scan_balance恒等于SCAN_FRACT
2436  scan等于如果mem_cgroup_online(memcg)则div64_u64 - unsigned 64bit divide with 64bit divisor*@dividend: 64bit dividend*@divisor: 64bit divisor* This implementation is a modified version of the algorithm proposed* by the book 'Hacker's Delight'. The original source and full proof否则DIV64_U64_ROUND_UP(scan * fraction[file], denominator)
2440  退出
2441  :scan_balance恒等于SCAN_FILE
2442  :scan_balance恒等于SCAN_ANON
2444  如果scan_balance恒等于SCAN_FILE不等于file
2445  lruvec_size等于0
2446  scan等于0
2448  退出
2449  默认
2451  BUG()
2454  nr[lru]等于scan
调用者
名称描述
shrink_lruvec