函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:do_shrink_slab

函数原型:static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, struct shrinker *shrinker, int priority)

返回类型:unsigned long

参数:

类型参数名称
struct shrink_control *shrinkctl
struct shrinker *shrinker
intpriority
430  freed等于0
436  nid等于current node being shrunk (for NUMA aware shrinkers)
437  batch_size等于如果claim batch size, 0 = default claim batch size, 0 = default 否则SHRINK_BATCH
439  scanned等于0
441  如果非flags按位与Flags 的值则nid等于0
444  freeable等于count_objects(shrinker, shrinkctl)
445  如果freeable恒等于0或freeable恒等于SHRINK_EMPTY则返回:freeable
453  nr等于atomic_long_xchg( & bjs pending delete, per node [nid], 0)
455  total_scan等于nr
456  如果seeks to recreate an obj
457  delta等于freeable右移priority
458  delta乘等于4
459  do_div() is NOT a C function(delta, seeks to recreate an obj )
460  否则
466  delta等于freeable除2
469  total_scan加等于delta
470  如果total_scan小于0则
471  打印错误信息("shrink_slab: %pS negative objects to delete nr=%ld\n", scan_objects, total_scan)
473  total_scan等于freeable
474  next_deferred等于nr
475  否则next_deferred等于total_scan
490  如果delta小于freeable除4则total_scan等于两数取小(total_scan, freeable / 2)
498  如果total_scan大于freeable乘2则total_scan等于freeable乘2
501  trace_mm_shrink_slab_start(shrinker, shrinkctl, nr, freeable, delta, total_scan, priority)
519 total_scan大于等于batch_sizetotal_scan大于等于freeable循环
522  nr_to_scan等于两数取小(batch_size, total_scan)
524  How many objects scan_objects should scan and try to reclaim.* This is reset before every call, so it is safe for callees* to modify.等于nr_to_scan
525  How many objects did scan_objects process?* This defaults to nr_to_scan before every call, but the callee* should track its actual progress.等于nr_to_scan
526  ret等于scan_objects(shrinker, shrinkctl)
527  如果ret恒等于SHRINK_STOP退出
529  freed加等于ret
531  count_vm_events(SLABS_SCANNED, How many objects did scan_objects process?* This defaults to nr_to_scan before every call, but the callee* should track its actual progress.)
532  total_scan减等于How many objects did scan_objects process?* This defaults to nr_to_scan before every call, but the callee* should track its actual progress.
533  scanned加等于How many objects did scan_objects process?* This defaults to nr_to_scan before every call, but the callee* should track its actual progress.
535  cond_resched()
538  如果next_deferred大于等于scannednext_deferred减等于scanned
540  否则next_deferred等于0
547  如果next_deferred大于0则new_nr等于atomic_long_add_return(next_deferred, & bjs pending delete, per node [nid])
550  否则new_nr等于atomic_long_read( & bjs pending delete, per node [nid])
553  trace_mm_shrink_slab_end(shrinker, nid, freed, nr, new_nr, total_scan)
554  返回:freed
调用者
名称描述
shrink_slab_memcg
shrink_slabshrink_slab - shrink slab caches*@gfp_mask: allocation context*@nid: node whose slab caches to target*@memcg: memory cgroup whose slab caches to target*@priority: the reclaim priority* Call the shrink functions to age shrinkable caches