[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190626165614.18586-1-longman@redhat.com>
Date: Wed, 26 Jun 2019 12:56:14 -0400
From: Waiman Long <longman@...hat.com>
To: Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Vladimir Davydov <vdavydov.dev@...il.com>,
Tejun Heo <tj@...nel.org>
Cc: linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Shakeel Butt <shakeelb@...gle.com>,
Waiman Long <longman@...hat.com>
Subject: [PATCH] memcg: Add kmem.slabinfo to v2 for debugging purpose
With memory cgroup v1, there is a kmem.slabinfo file that can be
used to view what slabs are allocated to the memory cgroup. There
is currently no such equivalent in memory cgroup v2. This file can
be useful for debugging purpose.
This patch adds an equivalent kmem.slabinfo to v2 with the caveat that
this file will only show up as ".__DEBUG__.memory.kmem.slabinfo" when the
"cgroup_debug" parameter is specified in the kernel boot command line.
This is to avoid cluttering the cgroup v2 interface with files that
are seldom used by end users.
Signed-off-by: Waiman Long <longman@...hat.com>
---
mm/memcontrol.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ba9138a4a1de..236554a23f8f 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5812,6 +5812,22 @@ static struct cftype memory_files[] = {
.seq_show = memory_oom_group_show,
.write = memory_oom_group_write,
},
+#ifdef CONFIG_MEMCG_KMEM
+ {
+ /*
+ * This file is for debugging purpose only and will show
+ * up as ".__DEBUG__.memory.kmem.slabinfo" when the
+ * "cgroup_debug" parameter is specified in the kernel
+ * boot command line.
+ */
+ .name = "kmem.slabinfo",
+ .flags = CFTYPE_NOT_ON_ROOT | CFTYPE_DEBUG,
+ .seq_start = memcg_slab_start,
+ .seq_next = memcg_slab_next,
+ .seq_stop = memcg_slab_stop,
+ .seq_show = memcg_slab_show,
+ },
+#endif
{ } /* terminate */
};
--
2.18.1
Powered by blists - more mailing lists