From: Tejun Heo <tj@kernel.org>
To: Waiman Long <longman@redhat.com>
Cc: lizefan@huawei.com, hannes@cmpxchg.org, peterz@infradead.org,
mingo@redhat.com, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-team@fb.com,
Tejun Heo <tj@kernel.org>
Subject: [PATCH 5/7] cgroup: make debug an implicit controller on cgroup2
Date: Wed, 14 Jun 2017 16:08:40 -0400 [thread overview]
Message-ID: <20170614200842.15174-6-tj@kernel.org> (raw)
In-Reply-To: <20170614200842.15174-1-tj@kernel.org>
Make debug an implicit controller on cgroup2 which is enabled by
"cgroup_debug" boot param.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Waiman Long <longman@redhat.com>
---
kernel/cgroup/debug.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 56 insertions(+), 3 deletions(-)
diff --git a/kernel/cgroup/debug.c b/kernel/cgroup/debug.c
index 057d9b07f461..d61e692a5338 100644
--- a/kernel/cgroup/debug.c
+++ b/kernel/cgroup/debug.c
@@ -240,7 +240,7 @@ static u64 releasable_read(struct cgroup_subsys_state *css, struct cftype *cft)
!css_has_online_children(&css->cgroup->self));
}
-static struct cftype debug_files[] = {
+static struct cftype debug_legacy_files[] = {
{
.name = "taskcount",
.read_u64 = debug_taskcount_read,
@@ -287,9 +287,62 @@ static struct cftype debug_files[] = {
{ } /* terminate */
};
+static struct cftype debug_files[] = {
+ {
+ .name = "taskcount",
+ .read_u64 = debug_taskcount_read,
+ },
+
+ {
+ .name = "current_css_set",
+ .seq_show = current_css_set_read,
+ .flags = CFTYPE_ONLY_ON_ROOT,
+ },
+
+ {
+ .name = "current_css_set_refcount",
+ .read_u64 = current_css_set_refcount_read,
+ .flags = CFTYPE_ONLY_ON_ROOT,
+ },
+
+ {
+ .name = "current_css_set_cg_links",
+ .seq_show = current_css_set_cg_links_read,
+ .flags = CFTYPE_ONLY_ON_ROOT,
+ },
+
+ {
+ .name = "css_links",
+ .seq_show = cgroup_css_links_read,
+ },
+
+ {
+ .name = "csses",
+ .seq_show = cgroup_subsys_states_read,
+ },
+
+ {
+ .name = "masks",
+ .seq_show = cgroup_masks_read,
+ },
+
+ { } /* terminate */
+};
+
struct cgroup_subsys debug_cgrp_subsys = {
.css_alloc = debug_css_alloc,
.css_free = debug_css_free,
- .legacy_cftypes = debug_files,
- .dfl_cftypes = debug_files,
+ .legacy_cftypes = debug_legacy_files,
};
+
+/*
+ * On v2, debug is an implicit controller enabled by "cgroup_debug" boot
+ * parameter.
+ */
+static int __init enable_cgroup_debug(char *str)
+{
+ debug_cgrp_subsys.dfl_cftypes = debug_files;
+ debug_cgrp_subsys.implicit_on_dfl = true;
+ return 1;
+}
+__setup("cgroup_debug", enable_cgroup_debug);
--
2.13.0
next prev parent reply other threads:[~2017-06-14 20:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 20:08 [PATCHSET] cgroup: Make debug controller useful for debugging Tejun Heo
2017-06-14 20:08 ` [PATCH 1/7] cgroup: Keep accurate count of tasks in each css_set Tejun Heo
2017-06-14 20:08 ` [PATCH 2/7] cgroup: Move debug cgroup to its own file Tejun Heo
2017-06-14 20:08 ` [PATCH 3/7] cgroup: Make Kconfig prompt of debug cgroup more accurate Tejun Heo
2017-06-14 20:08 ` [PATCH 4/7] cgroup: Make debug cgroup support v2 and thread mode Tejun Heo
2017-06-14 20:08 ` Tejun Heo [this message]
2017-06-14 20:08 ` [PATCH 6/7] cgroup: refactor cgroup_masks_read() in the debug controller Tejun Heo
2017-06-14 20:08 ` [PATCH 7/7] cgroup: fix lockdep warning in " Tejun Heo
2017-06-14 20:53 ` [PATCHSET] cgroup: Make debug controller useful for debugging Waiman Long
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=20170614200842.15174-6-tj@kernel.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/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