[Devel] [PATCH v2 v2 1/2] kernel, cgroup: Add abilty to enable css_stacks debuging via kernel command line

Andrey Ryabinin aryabinin at virtuozzo.com
Tue May 19 14:24:23 MSK 2020


Add "css_stacks" parameter to kernel's command line to enable css_stacks
debug at boot.

https://jira.sw.ru/browse/PSBM-98148
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 kernel/cgroup.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 17ba1ab9c7b0..bf218e88ac9d 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4192,6 +4192,7 @@ static int css_stacks_set(void *data, u64 val)
 DEFINE_SIMPLE_ATTRIBUTE(css_stacks_fops,
 		css_stacks_get, css_stacks_set, "%llu\n");
 
+int setup_css_stacks_cmd;
 static int __init css_stacks_debugfs(void)
 {
 	void *ret;
@@ -4200,9 +4201,18 @@ static int __init css_stacks_debugfs(void)
 			&css_stacks_fops);
 	if (!ret)
 		pr_warn("Failed to create css_stacks in debugfs");
+	if (setup_css_stacks_cmd)
+		static_key_slow_inc(&css_stacks_on);
 	return 0;
 }
 late_initcall(css_stacks_debugfs);
+
+static int __init setup_css_stacks(char *str)
+{
+	setup_css_stacks_cmd = 1;
+	return 1;
+}
+__setup("css_stacks", setup_css_stacks);
 #endif
 
 static void init_cgroup_css(struct cgroup_subsys_state *css,
-- 
2.26.2



More information about the Devel mailing list