lkml.org 
[lkml]   [2019]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] memcg: Add kmem.slabinfo to v2 for debugging purpose
Date
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@redhat.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
\
 
 \ /
  Last update: 2019-06-26 18:57    [W:0.058 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site