From: Dave Chinner <dchinner@redhat.com>
To: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Kent Overstreet <kent.overstreet@gmail.com>,
Hillf Danton <hdanton@sina.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: Re: [PATCH v3 3/6] mm: shrinkers: provide shrinkers with names
Date: Mon, 23 May 2022 08:13:41 +1000 [thread overview]
Message-ID: <Yoq1lRlneWj59Mte@rh> (raw)
In-Reply-To: <20220509183820.573666-4-roman.gushchin@linux.dev>
On Mon, May 09, 2022 at 11:38:17AM -0700, Roman Gushchin wrote:
> 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.
>
> After this change the shrinker debugfs directory looks like:
> $ cd /sys/kernel/debug/shrinker/
> $ ls
> dqcache-16 sb-hugetlbfs-17 sb-rootfs-2 sb-tmpfs-50
> kfree_rcu-0 sb-hugetlbfs-33 sb-securityfs-6 sb-tracefs-13
> sb-aio-20 sb-iomem-12 sb-selinuxfs-22 sb-xfs:vda1-36
> sb-anon_inodefs-15 sb-mqueue-21 sb-sockfs-8 sb-zsmalloc-19
> sb-bdev-3 sb-nsfs-4 sb-sysfs-26 shadow-18
> sb-bpf-32 sb-pipefs-14 sb-tmpfs-1 thp_deferred_split-10
> sb-btrfs:vda2-24 sb-proc-25 sb-tmpfs-27 thp_zero-9
> sb-cgroup2-30 sb-proc-39 sb-tmpfs-29 xfs_buf-37
> sb-configfs-23 sb-proc-41 sb-tmpfs-35 xfs_inodegc-38
^^^^^^^^^^^^^^
These XFS shrinkers are also per-block device like the superblock.
They need to read like "sb-xfs:vda1-36". and even though it is not
in this list, the xfs dquot shrinker will need this as well.
> sb-dax-11 sb-proc-45 sb-tmpfs-40 zspool-34
> sb-debugfs-7 sb-proc-46 sb-tmpfs-42
> sb-devpts-28 sb-proc-47 sb-tmpfs-43
> sb-devtmpfs-5 sb-pstore-31 sb-tmpfs-44
The proc and tmpfs shrinkers have the same problem - what instance
do they actually refer to?
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index e1afb9e503e1..5645e92df0c9 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -1986,7 +1986,7 @@ xfs_alloc_buftarg(
> btp->bt_shrinker.scan_objects = xfs_buftarg_shrink_scan;
> btp->bt_shrinker.seeks = DEFAULT_SEEKS;
> btp->bt_shrinker.flags = SHRINKER_NUMA_AWARE;
> - if (register_shrinker(&btp->bt_shrinker))
> + if (register_shrinker(&btp->bt_shrinker, "xfs_buf"))
> goto error_pcpu;
> return btp;
>
> diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
> index bffd6eb0b298..d0c4e74ff763 100644
> --- a/fs/xfs/xfs_icache.c
> +++ b/fs/xfs/xfs_icache.c
> @@ -2198,5 +2198,5 @@ xfs_inodegc_register_shrinker(
> shrink->flags = SHRINKER_NONSLAB;
> shrink->batch = XFS_INODEGC_SHRINKER_BATCH;
>
> - return register_shrinker(shrink);
> + return register_shrinker(shrink, "xfs_inodegc");
> }
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index f165d1a3de1d..93ded9e81f49 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -686,7 +686,7 @@ xfs_qm_init_quotainfo(
> qinf->qi_shrinker.seeks = DEFAULT_SEEKS;
> qinf->qi_shrinker.flags = SHRINKER_NUMA_AWARE;
>
> - error = register_shrinker(&qinf->qi_shrinker);
> + error = register_shrinker(&qinf->qi_shrinker, "xfs_qm");
> if (error)
> goto out_free_inos;
Yeah, these all have a xfs_mount passed to them, so the superblock is
easily accessible here (mp->m_super)....
Cheers,
Dave.
--
Dave Chinner
dchinner@redhat.com
next prev parent reply other threads:[~2022-05-22 22:13 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-09 18:38 [PATCH v3 0/6] mm: introduce shrinker debugfs interface Roman Gushchin
2022-05-09 18:38 ` [PATCH v3 1/6] mm: memcontrol: introduce mem_cgroup_ino() and mem_cgroup_get_from_ino() Roman Gushchin
2022-05-22 7:05 ` Muchun Song
2022-05-23 18:12 ` Roman Gushchin
2022-05-24 2:00 ` Muchun Song
2022-05-09 18:38 ` [PATCH v3 2/6] mm: shrinkers: introduce debugfs interface for memory shrinkers Roman Gushchin
2022-05-20 16:45 ` Kent Overstreet
2022-05-21 0:27 ` Roman Gushchin
2022-05-20 16:58 ` Christophe JAILLET
2022-05-20 17:00 ` Kent Overstreet
2022-05-21 0:27 ` Roman Gushchin
2022-05-22 10:36 ` Muchun Song
2022-05-23 18:24 ` Roman Gushchin
2022-05-24 2:06 ` Muchun Song
2022-05-09 18:38 ` [PATCH v3 3/6] mm: shrinkers: provide shrinkers with names Roman Gushchin
2022-05-20 16:41 ` Kent Overstreet
2022-05-21 0:31 ` Roman Gushchin
2022-05-22 11:08 ` Muchun Song
2022-05-23 22:06 ` Roman Gushchin
2022-05-24 9:12 ` Muchun Song
2022-05-22 22:13 ` Dave Chinner [this message]
2022-05-24 2:18 ` Roman Gushchin
2022-05-24 23:54 ` Roman Gushchin
2022-05-09 18:38 ` [PATCH v3 4/6] mm: docs: document shrinker debugfs Roman Gushchin
2022-05-09 18:38 ` [PATCH v3 5/6] tools: add memcg_shrinker.py Roman Gushchin
2022-05-09 18:38 ` [PATCH v3 6/6] mm: shrinkers: add scan interface for shrinker debugfs Roman Gushchin
2022-05-22 11:35 ` Muchun Song
2022-05-23 20:54 ` Roman Gushchin
2022-05-24 2:23 ` Muchun Song
2022-05-19 17:15 ` [PATCH v3 0/6] mm: introduce shrinker debugfs interface Roman Gushchin
2022-05-20 4:33 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yoq1lRlneWj59Mte@rh \
--to=dchinner@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=hdanton@sina.com \
--cc=kent.overstreet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=roman.gushchin@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).