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

Submitted by Andrey Ryabinin on May 19, 2020, 11:24 a.m.

Details

Message ID 20200519112424.3689-1-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin May 19, 2020, 11:24 a.m.
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@virtuozzo.com>
---
 kernel/cgroup.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch hide | download patch | download mbox

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,