linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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,
	Kent Overstreet <kent.overstreet@gmail.com>,
	Hillf Danton <hdanton@sina.com>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Muchun Song <songmuchun@bytedance.com>,
	Roman Gushchin <roman.gushchin@linux.dev>
Subject: [PATCH v4 4/6] mm: docs: document shrinker debugfs
Date: Wed, 25 May 2022 13:25:58 -0700	[thread overview]
Message-ID: <20220525202600.2910982-5-roman.gushchin@linux.dev> (raw)
In-Reply-To: <20220525202600.2910982-1-roman.gushchin@linux.dev>

Add a document describing the shrinker debugfs interface.

Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
---
 Documentation/admin-guide/mm/index.rst        |   1 +
 .../admin-guide/mm/shrinker_debugfs.rst       | 100 ++++++++++++++++++
 2 files changed, 101 insertions(+)
 create mode 100644 Documentation/admin-guide/mm/shrinker_debugfs.rst

diff --git a/Documentation/admin-guide/mm/index.rst b/Documentation/admin-guide/mm/index.rst
index c21b5823f126..1bd11118dfb1 100644
--- a/Documentation/admin-guide/mm/index.rst
+++ b/Documentation/admin-guide/mm/index.rst
@@ -36,6 +36,7 @@ the Linux memory management.
    numa_memory_policy
    numaperf
    pagemap
+   shrinker_debugfs
    soft-dirty
    swap_numa
    transhuge
diff --git a/Documentation/admin-guide/mm/shrinker_debugfs.rst b/Documentation/admin-guide/mm/shrinker_debugfs.rst
new file mode 100644
index 000000000000..2033d696aa59
--- /dev/null
+++ b/Documentation/admin-guide/mm/shrinker_debugfs.rst
@@ -0,0 +1,100 @@
+.. _shrinker_debugfs:
+
+==========================
+Shrinker Debugfs Interface
+==========================
+
+Shrinker debugfs interface provides a visibility into the kernel memory
+shrinkers subsystem and allows to get information about individual shrinkers.
+
+For each shrinker registered in the system a directory in **<debugfs>/shrinker/**
+is created. The directory's name is composed from the shrinker's name and an
+unique id: e.g. *kfree_rcu-0* or *sb-xfs:vda1-36*.
+
+Each shrinker directory contains the **count** file, which allows to trigger
+the *count_objects()* callback for each memcg and numa node (if applicable).
+
+Usage:
+------
+
+1. *List registered shrinkers*
+
+  ::
+
+    $ cd /sys/kernel/debug/shrinker/
+    $ ls
+    dqcache-16          sb-hugetlbfs-17  sb-rootfs-2      sb-tmpfs-49
+    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-vda1-37
+    sb-configfs-23      sb-proc-41       sb-tmpfs-35      xfs_inodegc-vda1-38
+    sb-dax-11           sb-proc-45       sb-tmpfs-40      zspool-zram0-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
+
+2. *Get information about a specific shrinker*
+
+  ::
+
+    $ cd sb-btrfs\:vda2-24/
+    $ ls
+    count
+
+3. *Count objects*
+
+  Each line in the output has the following format::
+
+    <cgroup inode id> <nr of objects on node 0> <nr of objects on node 1> ...
+    <cgroup inode id> <nr of objects on node 0> <nr of objects on node 1> ...
+    ...
+
+  If there are no objects on all numa nodes, a line is omitted. If there
+  are no objects at all, the output might be empty.
+  ::
+
+    $ cat count
+    1 224 2
+    21 98 0
+    55 818 10
+    2367 2 0
+    2401 30 0
+    225 13 0
+    599 35 0
+    939 124 0
+    1041 3 0
+    1075 1 0
+    1109 1 0
+    1279 60 0
+    1313 7 0
+    1347 39 0
+    1381 3 0
+    1449 14 0
+    1483 63 0
+    1517 53 0
+    1551 6 0
+    1585 1 0
+    1619 6 0
+    1653 40 0
+    1687 11 0
+    1721 8 0
+    1755 4 0
+    1789 52 0
+    1823 888 0
+    1857 1 0
+    1925 2 0
+    1959 32 0
+    2027 22 0
+    2061 9 0
+    2469 799 0
+    2537 861 0
+    2639 1 0
+    2707 70 0
+    2775 4 0
+    2877 84 0
+    293 1 0
+    735 8 0
-- 
2.35.3


  parent reply	other threads:[~2022-05-25 20:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 20:25 [PATCH v4 0/6] mm: introduce shrinker debugfs interface Roman Gushchin
2022-05-25 20:25 ` [PATCH v4 1/6] mm: memcontrol: introduce mem_cgroup_ino() and mem_cgroup_get_from_ino() Roman Gushchin
2022-05-26  1:53   ` Muchun Song
2022-05-25 20:25 ` [PATCH v4 2/6] mm: shrinkers: introduce debugfs interface for memory shrinkers Roman Gushchin
2022-05-26  1:58   ` Muchun Song
2022-05-25 20:25 ` [PATCH v4 3/6] mm: shrinkers: provide shrinkers with names Roman Gushchin
2022-05-27  9:30   ` Dave Chinner
2022-05-27 18:00     ` Roman Gushchin
2022-05-25 20:25 ` Roman Gushchin [this message]
2022-05-26  2:01   ` [PATCH v4 4/6] mm: docs: document shrinker debugfs Muchun Song
2022-05-26  2:25   ` Muchun Song
2022-05-26 20:35     ` Roman Gushchin
2022-05-25 20:25 ` [PATCH v4 5/6] tools: add memcg_shrinker.py Roman Gushchin
2022-05-25 20:26 ` [PATCH v4 6/6] mm: shrinkers: add scan interface for shrinker debugfs Roman Gushchin
2022-05-26  3:46   ` Muchun Song

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=20220525202600.2910982-5-roman.gushchin@linux.dev \
    --to=roman.gushchin@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --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=songmuchun@bytedance.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;
as well as URLs for NNTP newsgroup(s).