]> git.baikalelectronics.ru Git - kernel.git/commit
mm: shrinkers: provide shrinkers with names
authorRoman Gushchin <roman.gushchin@linux.dev>
Wed, 1 Jun 2022 03:22:24 +0000 (20:22 -0700)
committerakpm <akpm@linux-foundation.org>
Mon, 4 Jul 2022 01:08:40 +0000 (18:08 -0700)
commit2d595fe7b73c91c5bf2ef5bc47c2f5086251358a
tree625ae2ff52e80b8a602acd0d459e781893495bdb
parentd0bd0df0db4da9b51ea878d090df179839942cfb
mm: shrinkers: provide shrinkers with names

Currently shrinkers are anonymous objects.  For debugging purposes they
can be identified by count/scan function names, but it's not always
useful: e.g.  for superblock's shrinkers it's nice to have at least an
idea of to which superblock the shrinker belongs.

This commit adds names to shrinkers.  register_shrinker() and
prealloc_shrinker() functions are extended to take a format and arguments
to master a name.

In some cases it's not possible to determine a good name at the time when
a shrinker is allocated.  For such cases shrinker_debugfs_rename() is
provided.

The expected format is:
    <subsystem>-<shrinker_type>[:<instance>]-<id>
For some shrinkers an instance can be encoded as (MAJOR:MINOR) pair.

After this change the shrinker debugfs directory looks like:
  $ cd /sys/kernel/debug/shrinker/
  $ ls
    dquota-cache-16     sb-devpts-28     sb-proc-47       sb-tmpfs-42
    mm-shadow-18        sb-devtmpfs-5    sb-proc-48       sb-tmpfs-43
    mm-zspool:zram0-34  sb-hugetlbfs-17  sb-pstore-31     sb-tmpfs-44
    rcu-kfree-0         sb-hugetlbfs-33  sb-rootfs-2      sb-tmpfs-49
    sb-aio-20           sb-iomem-12      sb-securityfs-6  sb-tracefs-13
    sb-anon_inodefs-15  sb-mqueue-21     sb-selinuxfs-22  sb-xfs:vda1-36
    sb-bdev-3           sb-nsfs-4        sb-sockfs-8      sb-zsmalloc-19
    sb-bpf-32           sb-pipefs-14     sb-sysfs-26      thp-deferred_split-10
    sb-btrfs:vda2-24    sb-proc-25       sb-tmpfs-1       thp-zero-9
    sb-cgroup2-30       sb-proc-39       sb-tmpfs-27      xfs-buf:vda1-37
    sb-configfs-23      sb-proc-41       sb-tmpfs-29      xfs-inodegc:vda1-38
    sb-dax-11           sb-proc-45       sb-tmpfs-35
    sb-debugfs-7        sb-proc-46       sb-tmpfs-40

[roman.gushchin@linux.dev: fix build warnings]
Link: https://lkml.kernel.org/r/Yr+ZTnLb9lJk6fJO@castle
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lkml.kernel.org/r/20220601032227.4076670-4-roman.gushchin@linux.dev
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Kent Overstreet <kent.overstreet@gmail.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
39 files changed:
arch/x86/kvm/mmu/mmu.c
drivers/android/binder_alloc.c
drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
drivers/gpu/drm/msm/msm_gem_shrinker.c
drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
drivers/gpu/drm/ttm/ttm_pool.c
drivers/md/bcache/btree.c
drivers/md/dm-bufio.c
drivers/md/dm-zoned-metadata.c
drivers/md/raid5.c
drivers/misc/vmw_balloon.c
drivers/virtio/virtio_balloon.c
drivers/xen/xenbus/xenbus_probe_backend.c
fs/btrfs/super.c
fs/erofs/utils.c
fs/ext4/extents_status.c
fs/f2fs/super.c
fs/gfs2/glock.c
fs/gfs2/main.c
fs/jbd2/journal.c
fs/mbcache.c
fs/nfs/nfs42xattr.c
fs/nfs/super.c
fs/nfsd/filecache.c
fs/nfsd/nfscache.c
fs/quota/dquot.c
fs/super.c
fs/ubifs/super.c
fs/xfs/xfs_buf.c
fs/xfs/xfs_icache.c
fs/xfs/xfs_qm.c
include/linux/shrinker.h
kernel/rcu/tree.c
mm/huge_memory.c
mm/shrinker_debug.c
mm/vmscan.c
mm/workingset.c
mm/zsmalloc.c
net/sunrpc/auth.c