Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1665207

[PATCH-cgroup 5/5] cgroup: Enable debug controller only with cgroup_debug boot option

From Waiman Long <longman@redhat.com>
Newsgroups linux.kernel
Subject [PATCH-cgroup 5/5] cgroup: Enable debug controller only with cgroup_debug boot option
Date 2017-06-13 23:20 +0200
Message-ID <tS1od-4EQ-15@gated-at.bofh.it> (permalink)
References <tS1od-4EQ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH-cgroup 0/5] cgroup: Make debug controller useful for debugging Waiman Long <longman@redhat.com> - 2017-06-13 23:20 +0200
  [PATCH-cgroup 3/5] cgroup: Make Kconfig prompt of debug cgroup more accurate Waiman Long <longman@redhat.com> - 2017-06-13 23:20 +0200
  [PATCH-cgroup 5/5] cgroup: Enable debug controller only with cgroup_debug boot option Waiman Long <longman@redhat.com> - 2017-06-13 23:20 +0200
  [PATCH-cgroup 1/5] cgroup: Keep accurate count of tasks in each css_set Waiman Long <longman@redhat.com> - 2017-06-13 23:20 +0200
  [PATCH-cgroup 4/5] cgroup: Make debug cgroup support v2 and thread mode Waiman Long <longman@redhat.com> - 2017-06-13 23:20 +0200
  [PATCH-cgroup 2/5] cgroup: Move debug cgroup to its own file Waiman Long <longman@redhat.com> - 2017-06-13 23:20 +0200

csiph-web