From: Roman Gushchin <roman.gushchin@linux.dev>
To: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Cc: Dave Chinner <dchinner@redhat.com>,
linux-kernel@vger.kernel.org, Yang Shi <shy828301@gmail.com>,
Kent Overstreet <kent.overstreet@gmail.com>,
Hillf Danton <hdanton@sina.com>
Subject: Re: [PATCH v1 0/5] mm: introduce shrinker debugfs interface
Date: Fri, 22 Apr 2022 07:57:55 -0700 [thread overview]
Message-ID: <YmLCc/DiqJs0jFIX@carbon> (raw)
In-Reply-To: <20220422015853.748291-1-roman.gushchin@linux.dev>
On Thu, Apr 21, 2022 at 06:58:48PM -0700, Roman Gushchin wrote:
> There are 50+ different shrinkers in the kernel, many with their own bells and
> whistles. Under the memory pressure the kernel applies some pressure on each of
> them in the order of which they were created/registered in the system. Some
> of them can contain only few objects, some can be quite large. Some can be
> effective at reclaiming memory, some not.
>
> The only existing debugging mechanism is a couple of tracepoints in
> do_shrink_slab(): mm_shrink_slab_start and mm_shrink_slab_end. They aren't
> covering everything though: shrinkers which report 0 objects will never show up,
> there is no support for memcg-aware shrinkers. Shrinkers are identified by their
> scan function, which is not always enough (e.g. hard to guess which super
> block's shrinker it is having only "super_cache_scan"). They are a passive
> mechanism: there is no way to call into counting and scanning of an individual
> shrinker and profile it.
>
> To provide a better visibility and debug options for memory shrinkers
> this patchset introduces a /sys/kernel/debug/shrinker interface, to some extent
> similar to /sys/kernel/slab.
>
> For each shrinker registered in the system a directory is created. The directory
> contains "count" and "scan" files, which allow to trigger count_objects()
> and scan_objects() callbacks. For memcg-aware and numa-aware shrinkers
> count_memcg, scan_memcg, count_node, scan_node, count_memcg_node
> and scan_memcg_node are additionally provided. They allow to get per-memcg
> and/or per-node object count and shrink only a specific memcg/node.
>
> To make debugging more pleasant, the patchset also names all shrinkers,
> so that debugfs entries can have more meaningful names.
>
> v1:
> 1) switched to debugfs, suggested by Mike, Andrew, Greg and others
> 2) switched to seq_file API for output, no PAGE_SIZE limit anymore, by Andrew
> 3) switched to down_read_killable(), suggested by Hillf
> 4) dropped stateful filtering and "freed" returning, by Kent
> 5) added docs, by Andrew
Not quite true, gonna add it and also a cgroup tree inspection tool
and send out v2.
Thanks!
prev parent reply other threads:[~2022-04-22 14:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-22 1:58 Roman Gushchin
2022-04-22 1:58 ` [PATCH v1 1/5] mm: introduce debugfs interface for kernel memory shrinkers Roman Gushchin
2022-04-22 1:58 ` [PATCH v1 2/5] mm: memcontrol: introduce mem_cgroup_ino() and mem_cgroup_get_from_ino() Roman Gushchin
2022-04-22 1:58 ` [PATCH v1 3/5] mm: introduce memcg interfaces for shrinker debugfs Roman Gushchin
2022-04-22 1:58 ` [PATCH v1 4/5] mm: introduce numa " Roman Gushchin
2022-04-22 1:58 ` [PATCH v1 5/5] mm: provide shrinkers with names Roman Gushchin
2022-04-22 14:57 ` Roman Gushchin [this message]
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=YmLCc/DiqJs0jFIX@carbon \
--to=roman.gushchin@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=dchinner@redhat.com \
--cc=hdanton@sina.com \
--cc=kent.overstreet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shy828301@gmail.com \
/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