Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:do_shrink_slab

Proto:static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, struct shrinker *shrinker, int priority)

Type:unsigned long

Parameter:

TypeParameterName
struct shrink_control *shrinkctl
struct shrinker *shrinker
intpriority
430  freed = 0
436  nid = current node being shrunk (for NUMA aware shrinkers)
437  batch_size = If claim batch size, 0 = default Then claim batch size, 0 = default Else SHRINK_BATCH
439  scanned = 0
441  If Not (flags & Flags ) Then nid = 0
444  freeable = count_objects(shrinker, shrinkctl)
445  If freeable == 0 || freeable == SHRINK_EMPTY Then Return freeable
453  nr = atomic_long_xchg( & bjs pending delete, per node [nid], 0)
455  total_scan = nr
456  If seeks to recreate an obj Then
457  delta = freeable >> priority
458  delta *= 4
459  do_div() is NOT a C function(delta, seeks to recreate an obj )
460  Else
466  delta = freeable / 2
469  total_scan += delta
470  If total_scan < 0 Then
471  pr_err("shrink_slab: %pS negative objects to delete nr=%ld\n", scan_objects, total_scan)
473  total_scan = freeable
474  next_deferred = nr
475  Else next_deferred = total_scan
490  If delta < freeable / 4 Then total_scan = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(total_scan, freeable / 2)
498  If total_scan > freeable * 2 Then total_scan = freeable * 2
501  trace_mm_shrink_slab_start(shrinker, shrinkctl, nr, freeable, delta, total_scan, priority)
519  When total_scan >= batch_size || total_scan >= freeable cycle
522  nr_to_scan = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(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  If ret == SHRINK_STOP Then Break
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  If next_deferred >= scanned Then next_deferred -= scanned
540  Else next_deferred = 0
547  If next_deferred > 0 Then new_nr = atomic_long_add_return(next_deferred, & bjs pending delete, per node [nid])
550  Else 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  Return freed
Caller
NameDescribe
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