brintos

brintos / linux-shallow public Read only

0
0
Text · 3.3 KiB · c582033 Raw
134 lines · plain
1==========================2Shrinker Debugfs Interface3==========================4 5Shrinker debugfs interface provides a visibility into the kernel memory6shrinkers subsystem and allows to get information about individual shrinkers7and interact with them.8 9For each shrinker registered in the system a directory in **<debugfs>/shrinker/**10is created. The directory's name is composed from the shrinker's name and an11unique id: e.g. *kfree_rcu-0* or *sb-xfs:vda1-36*.12 13Each shrinker directory contains **count** and **scan** files, which allow to14trigger *count_objects()* and *scan_objects()* callbacks for each memcg and15numa node (if applicable).16 17Usage:18------19 201. *List registered shrinkers*21 22  ::23 24    $ cd /sys/kernel/debug/shrinker/25    $ ls26    dquota-cache-16     sb-devpts-28     sb-proc-47       sb-tmpfs-4227    mm-shadow-18        sb-devtmpfs-5    sb-proc-48       sb-tmpfs-4328    mm-zspool:zram0-34  sb-hugetlbfs-17  sb-pstore-31     sb-tmpfs-4429    rcu-kfree-0         sb-hugetlbfs-33  sb-rootfs-2      sb-tmpfs-4930    sb-aio-20           sb-iomem-12      sb-securityfs-6  sb-tracefs-1331    sb-anon_inodefs-15  sb-mqueue-21     sb-selinuxfs-22  sb-xfs:vda1-3632    sb-bdev-3           sb-nsfs-4        sb-sockfs-8      sb-zsmalloc-1933    sb-bpf-32           sb-pipefs-14     sb-sysfs-26      thp-deferred_split-1034    sb-btrfs:vda2-24    sb-proc-25       sb-tmpfs-1       thp-zero-935    sb-cgroup2-30       sb-proc-39       sb-tmpfs-27      xfs-buf:vda1-3736    sb-configfs-23      sb-proc-41       sb-tmpfs-29      xfs-inodegc:vda1-3837    sb-dax-11           sb-proc-45       sb-tmpfs-3538    sb-debugfs-7        sb-proc-46       sb-tmpfs-4039 402. *Get information about a specific shrinker*41 42  ::43 44    $ cd sb-btrfs\:vda2-24/45    $ ls46    count            scan47 483. *Count objects*49 50  Each line in the output has the following format::51 52    <cgroup inode id> <nr of objects on node 0> <nr of objects on node 1> ...53    <cgroup inode id> <nr of objects on node 0> <nr of objects on node 1> ...54    ...55 56  If there are no objects on all numa nodes, a line is omitted. If there57  are no objects at all, the output might be empty.58 59  If the shrinker is not memcg-aware or CONFIG_MEMCG is off, 0 is printed60  as cgroup inode id. If the shrinker is not numa-aware, 0's are printed61  for all nodes except the first one.62  ::63 64    $ cat count65    1 224 266    21 98 067    55 818 1068    2367 2 069    2401 30 070    225 13 071    599 35 072    939 124 073    1041 3 074    1075 1 075    1109 1 076    1279 60 077    1313 7 078    1347 39 079    1381 3 080    1449 14 081    1483 63 082    1517 53 083    1551 6 084    1585 1 085    1619 6 086    1653 40 087    1687 11 088    1721 8 089    1755 4 090    1789 52 091    1823 888 092    1857 1 093    1925 2 094    1959 32 095    2027 22 096    2061 9 097    2469 799 098    2537 861 099    2639 1 0100    2707 70 0101    2775 4 0102    2877 84 0103    293 1 0104    735 8 0105 1064. *Scan objects*107 108  The expected input format::109 110    <cgroup inode id> <numa id> <number of objects to scan>111 112  For a non-memcg-aware shrinker or on a system with no memory113  cgrups **0** should be passed as cgroup id.114  ::115 116    $ cd /sys/kernel/debug/shrinker/117    $ cd sb-btrfs\:vda2-24/118 119    $ cat count | head -n 5120    1 212 0121    21 97 0122    55 802 5123    2367 2 0124    225 13 0125 126    $ echo "55 0 200" > scan127 128    $ cat count | head -n 5129    1 212 0130    21 96 0131    55 752 5132    2367 2 0133    225 13 0134