All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged mm-stable] tools-add-memcg_shrinkerpy.patch removed from -mm tree
@ 2022-07-04  1:09 Andrew Morton
  2022-07-04  1:42 ` [PATCH 1/3] 9p: Drop kref usage Kent Overstreet
  0 siblings, 1 reply; 31+ messages in thread
From: Andrew Morton @ 2022-07-04  1:09 UTC (permalink / raw)
  To: mm-commits, songmuchun, kent.overstreet, hdanton, dchinner,
	christophe.jaillet, roman.gushchin, akpm


The quilt patch titled
     Subject: tools: add memcg_shrinker.py
has been removed from the -mm tree.  Its filename was
     tools-add-memcg_shrinkerpy.patch

This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Roman Gushchin <roman.gushchin@linux.dev>
Subject: tools: add memcg_shrinker.py
Date: Tue, 31 May 2022 20:22:26 -0700

Add a simple tool which prints a sorted list of shrinker lists in the
following format: (number of objects, shrinker name, cgroup).

Example:
  $ ./memcg_shrinker.py -n 10
  2090     sb-sysfs-26          /sys/fs/cgroup/system.slice
  1809     sb-sysfs-26          /sys/fs/cgroup/system.slice/systemd-udevd.service
  1044     sb-btrfs:vda2-24     /sys/fs/cgroup/system.slice/system-dbus\x2d:1.3\...
  861      sb-btrfs:vda2-24     /sys/fs/cgroup/system.slice/system-dbus\x2d:1.3\...
  804      sb-btrfs:vda2-24     /sys/fs/cgroup/system.slice
  643      sb-btrfs:vda2-24     /sys/fs/cgroup/system.slice/firewalld.service
  616      sb-cgroup2-30        /sys/fs/cgroup/init.scope
  275      sb-sysfs-26          /
  238      sb-proc-25           /sys/fs/cgroup/system.slice/systemd-journald.service
  225      sb-proc-25           /sys/fs/cgroup/system.slice/abrtd.service

Link: https://lkml.kernel.org/r/20220601032227.4076670-6-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>
---

 tools/cgroup/memcg_shrinker.py |   71 +++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

--- /dev/null
+++ a/tools/cgroup/memcg_shrinker.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2022 Roman Gushchin <roman.gushchin@linux.dev>
+# Copyright (C) 2022 Meta
+
+import os
+import argparse
+import sys
+
+
+def scan_cgroups(cgroup_root):
+    cgroups = {}
+
+    for root, subdirs, _ in os.walk(cgroup_root):
+        for cgroup in subdirs:
+            path = os.path.join(root, cgroup)
+            ino = os.stat(path).st_ino
+            cgroups[ino] = path
+
+    # (memcg ino, path)
+    return cgroups
+
+
+def scan_shrinkers(shrinker_debugfs):
+    shrinkers = []
+
+    for root, subdirs, _ in os.walk(shrinker_debugfs):
+        for shrinker in subdirs:
+            count_path = os.path.join(root, shrinker, "count")
+            with open(count_path) as f:
+                for line in f.readlines():
+                    items = line.split(' ')
+                    ino = int(items[0])
+                    # (count, shrinker, memcg ino)
+                    shrinkers.append((int(items[1]), shrinker, ino))
+    return shrinkers
+
+
+def main():
+    parser = argparse.ArgumentParser(description='Display biggest shrinkers')
+    parser.add_argument('-n', '--lines', type=int, help='Number of lines to print')
+
+    args = parser.parse_args()
+
+    cgroups = scan_cgroups("/sys/fs/cgroup/")
+    shrinkers = scan_shrinkers("/sys/kernel/debug/shrinker/")
+    shrinkers = sorted(shrinkers, reverse = True, key = lambda x: x[0])
+
+    n = 0
+    for s in shrinkers:
+        count, name, ino = (s[0], s[1], s[2])
+        if count == 0:
+            break
+
+        if ino == 0 or ino == 1:
+            cg = "/"
+        else:
+            try:
+                cg = cgroups[ino]
+            except KeyError:
+                cg = "unknown (%d)" % ino
+
+        print("%-8s %-20s %s" % (count, name, cg))
+
+        n += 1
+        if args.lines and n >= args.lines:
+            break
+
+
+if __name__ == '__main__':
+    main()
_

Patches currently in -mm which might be from roman.gushchin@linux.dev are

mm-shrinkers-add-scan-interface-for-shrinker-debugfs.patch
mm-memcontrol-do-not-miss-memcg_max-events-for-enforced-allocations.patch


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2022-07-15 10:23 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04  1:09 [merged mm-stable] tools-add-memcg_shrinkerpy.patch removed from -mm tree Andrew Morton
2022-07-04  1:42 ` [PATCH 1/3] 9p: Drop kref usage Kent Overstreet
2022-07-04  1:42   ` [PATCH 2/3] 9p: Add client parameter to p9_req_put() Kent Overstreet
2022-07-04  1:42   ` [PATCH 3/3] 9p: Add mempools for RPCs Kent Overstreet
2022-07-04  2:22     ` Dominique Martinet
2022-07-04  3:05       ` Kent Overstreet
2022-07-04  3:38         ` Dominique Martinet
2022-07-04  3:52           ` Kent Overstreet
2022-07-04 11:12           ` Christian Schoenebeck
2022-07-04 13:06             ` Dominique Martinet
2022-07-04 13:56               ` Christian Schoenebeck
2022-07-09  7:43                 ` Dominique Martinet
2022-07-09 14:21                   ` Christian Schoenebeck
2022-07-09 14:42                     ` Dominique Martinet
2022-07-09 18:08                       ` Christian Schoenebeck
2022-07-09 20:50                         ` Dominique Martinet
2022-07-10 12:57                           ` Christian Schoenebeck
2022-07-10 13:19                             ` Dominique Martinet
2022-07-10 15:16                               ` Christian Schoenebeck
2022-07-13  4:17                                 ` [RFC PATCH] 9p: forbid use of mempool for TFLUSH Dominique Martinet
2022-07-13  6:39                                   ` Kent Overstreet
2022-07-13  7:12                                     ` Dominique Martinet
2022-07-13  7:40                                       ` Kent Overstreet
2022-07-13  8:18                                         ` Dominique Martinet
2022-07-14 19:16                                   ` Christian Schoenebeck
2022-07-14 22:31                                     ` Dominique Martinet
2022-07-15 10:23                                       ` Christian Schoenebeck
2022-07-04 13:06             ` [PATCH 3/3] 9p: Add mempools for RPCs Kent Overstreet
2022-07-04 13:39               ` Christian Schoenebeck
2022-07-04 14:19                 ` Kent Overstreet
2022-07-05  9:59                   ` Christian Schoenebeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.