From: Waiman Long <longman@redhat.com>
To: Tejun Heo <tj@kernel.org>, Li Zefan <lizefan@huawei.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, pjt@google.com, luto@amacapital.net,
efault@gmx.de, torvalds@linux-foundation.org,
Waiman Long <longman@redhat.com>
Subject: [PATCH-cgroup 5/5] cgroup: Enable debug controller only with cgroup_debug boot option
Date: Tue, 13 Jun 2017 17:18:05 -0400 [thread overview]
Message-ID: <1497388685-31207-6-git-send-email-longman@redhat.com> (raw)
In-Reply-To: <1497388685-31207-1-git-send-email-longman@redhat.com>
As suggested by Tejun, the debug controller will be activated only when
the "cgroup_debug" option is specified in the kernel boot command line.
Hopefully, that will discourage people from using the debug controller
for any purpose other than cgroup core debugging.
Signed-off-by: Waiman Long <longman@redhat.com>
---
kernel/cgroup/debug.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/kernel/cgroup/debug.c b/kernel/cgroup/debug.c
index 82e5cbd..be901c0 100644
--- a/kernel/cgroup/debug.c
+++ b/kernel/cgroup/debug.c
@@ -320,3 +320,23 @@ struct cgroup_subsys debug_cgrp_subsys = {
.dfl_cftypes = debug_files,
.threaded = true,
};
+
+/*
+ * Disable the debug controller by hiding the debug cgroup control files
+ * if the kernel boot parameter "cgroup_debug" isn't set.
+ */
+static bool cgroup_debug_enable __initdata;
+static int __init enable_cgroup_debug(char *str)
+{
+ cgroup_debug_enable = true;
+ return 1;
+}
+__setup("cgroup_debug", enable_cgroup_debug);
+
+static int __init debug_init(void)
+{
+ if (!cgroup_debug_enable)
+ debug_files[0].name[0] = '\0';
+ return 0;
+}
+core_initcall(debug_init);
--
1.8.3.1
prev parent reply other threads:[~2017-06-13 21:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-13 21:18 [PATCH-cgroup 0/5] cgroup: Make debug controller useful for debugging Waiman Long
2017-06-13 21:18 ` [PATCH-cgroup 1/5] cgroup: Keep accurate count of tasks in each css_set Waiman Long
2017-06-13 21:18 ` [PATCH-cgroup 2/5] cgroup: Move debug cgroup to its own file Waiman Long
2017-06-13 21:18 ` [PATCH-cgroup 3/5] cgroup: Make Kconfig prompt of debug cgroup more accurate Waiman Long
2017-06-13 21:18 ` [PATCH-cgroup 4/5] cgroup: Make debug cgroup support v2 and thread mode Waiman Long
2017-06-13 21:18 ` Waiman Long [this message]
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=1497388685-31207-6-git-send-email-longman@redhat.com \
--to=longman@redhat.com \
--cc=cgroups@vger.kernel.org \
--cc=efault@gmx.de \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.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
Powered by JetHome