diff options
-rw-r--r-- | include/linux/cgroup-defs.h | 1 | ||||
-rw-r--r-- | kernel/cgroup/cgroup-internal.h | 2 | ||||
-rw-r--r-- | kernel/cgroup/cgroup.c | 14 | ||||
-rw-r--r-- | kernel/cgroup/cpuset.c | 11 | ||||
-rw-r--r-- | kernel/cgroup/debug.c | 4 |
5 files changed, 28 insertions, 4 deletions
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index 5e1694fe035b..8fcbae1b8db0 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h | |||
@@ -92,6 +92,7 @@ enum { | |||
92 | 92 | ||
93 | CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ | 93 | CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ |
94 | CFTYPE_WORLD_WRITABLE = (1 << 4), /* (DON'T USE FOR NEW FILES) S_IWUGO */ | 94 | CFTYPE_WORLD_WRITABLE = (1 << 4), /* (DON'T USE FOR NEW FILES) S_IWUGO */ |
95 | CFTYPE_DEBUG = (1 << 5), /* create when cgroup_debug */ | ||
95 | 96 | ||
96 | /* internal flags, do not use outside cgroup core proper */ | 97 | /* internal flags, do not use outside cgroup core proper */ |
97 | __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */ | 98 | __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */ |
diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index 75568fcf2180..c950864016e2 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #define TRACE_CGROUP_PATH_LEN 1024 | 11 | #define TRACE_CGROUP_PATH_LEN 1024 |
12 | extern spinlock_t trace_cgroup_path_lock; | 12 | extern spinlock_t trace_cgroup_path_lock; |
13 | extern char trace_cgroup_path[TRACE_CGROUP_PATH_LEN]; | 13 | extern char trace_cgroup_path[TRACE_CGROUP_PATH_LEN]; |
14 | extern bool cgroup_debug; | ||
15 | extern void __init enable_debug_cgroup(void); | ||
14 | 16 | ||
15 | /* | 17 | /* |
16 | * cgroup_path() takes a spin lock. It is good practice not to take | 18 | * cgroup_path() takes a spin lock. It is good practice not to take |
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 2e5d90dfcb49..ed7f0bfe6429 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c | |||
@@ -86,6 +86,7 @@ EXPORT_SYMBOL_GPL(css_set_lock); | |||
86 | 86 | ||
87 | DEFINE_SPINLOCK(trace_cgroup_path_lock); | 87 | DEFINE_SPINLOCK(trace_cgroup_path_lock); |
88 | char trace_cgroup_path[TRACE_CGROUP_PATH_LEN]; | 88 | char trace_cgroup_path[TRACE_CGROUP_PATH_LEN]; |
89 | bool cgroup_debug __read_mostly; | ||
89 | 90 | ||
90 | /* | 91 | /* |
91 | * Protects cgroup_idr and css_idr so that IDs can be released without | 92 | * Protects cgroup_idr and css_idr so that IDs can be released without |
@@ -3639,7 +3640,8 @@ restart: | |||
3639 | continue; | 3640 | continue; |
3640 | if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgroup_parent(cgrp)) | 3641 | if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgroup_parent(cgrp)) |
3641 | continue; | 3642 | continue; |
3642 | 3643 | if ((cft->flags & CFTYPE_DEBUG) && !cgroup_debug) | |
3644 | continue; | ||
3643 | if (is_add) { | 3645 | if (is_add) { |
3644 | ret = cgroup_add_file(css, cgrp, cft); | 3646 | ret = cgroup_add_file(css, cgrp, cft); |
3645 | if (ret) { | 3647 | if (ret) { |
@@ -5743,6 +5745,16 @@ static int __init cgroup_disable(char *str) | |||
5743 | } | 5745 | } |
5744 | __setup("cgroup_disable=", cgroup_disable); | 5746 | __setup("cgroup_disable=", cgroup_disable); |
5745 | 5747 | ||
5748 | void __init __weak enable_debug_cgroup(void) { } | ||
5749 | |||
5750 | static int __init enable_cgroup_debug(char *str) | ||
5751 | { | ||
5752 | cgroup_debug = true; | ||
5753 | enable_debug_cgroup(); | ||
5754 | return 1; | ||
5755 | } | ||
5756 | __setup("cgroup_debug", enable_cgroup_debug); | ||
5757 | |||
5746 | /** | 5758 | /** |
5747 | * css_tryget_online_from_dir - get corresponding css from a cgroup dentry | 5759 | * css_tryget_online_from_dir - get corresponding css from a cgroup dentry |
5748 | * @dentry: directory dentry of interest | 5760 | * @dentry: directory dentry of interest |
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index c739fda805e0..b897314bab53 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c | |||
@@ -2204,6 +2204,7 @@ typedef enum { | |||
2204 | FILE_MEMLIST, | 2204 | FILE_MEMLIST, |
2205 | FILE_EFFECTIVE_CPULIST, | 2205 | FILE_EFFECTIVE_CPULIST, |
2206 | FILE_EFFECTIVE_MEMLIST, | 2206 | FILE_EFFECTIVE_MEMLIST, |
2207 | FILE_SUBPARTS_CPULIST, | ||
2207 | FILE_CPU_EXCLUSIVE, | 2208 | FILE_CPU_EXCLUSIVE, |
2208 | FILE_MEM_EXCLUSIVE, | 2209 | FILE_MEM_EXCLUSIVE, |
2209 | FILE_MEM_HARDWALL, | 2210 | FILE_MEM_HARDWALL, |
@@ -2382,6 +2383,9 @@ static int cpuset_common_seq_show(struct seq_file *sf, void *v) | |||
2382 | case FILE_EFFECTIVE_MEMLIST: | 2383 | case FILE_EFFECTIVE_MEMLIST: |
2383 | seq_printf(sf, "%*pbl\n", nodemask_pr_args(&cs->effective_mems)); | 2384 | seq_printf(sf, "%*pbl\n", nodemask_pr_args(&cs->effective_mems)); |
2384 | break; | 2385 | break; |
2386 | case FILE_SUBPARTS_CPULIST: | ||
2387 | seq_printf(sf, "%*pbl\n", cpumask_pr_args(cs->subparts_cpus)); | ||
2388 | break; | ||
2385 | default: | 2389 | default: |
2386 | ret = -EINVAL; | 2390 | ret = -EINVAL; |
2387 | } | 2391 | } |
@@ -2634,6 +2638,13 @@ static struct cftype dfl_files[] = { | |||
2634 | .flags = CFTYPE_NOT_ON_ROOT, | 2638 | .flags = CFTYPE_NOT_ON_ROOT, |
2635 | }, | 2639 | }, |
2636 | 2640 | ||
2641 | { | ||
2642 | .name = "cpus.subpartitions", | ||
2643 | .seq_show = cpuset_common_seq_show, | ||
2644 | .private = FILE_SUBPARTS_CPULIST, | ||
2645 | .flags = CFTYPE_DEBUG, | ||
2646 | }, | ||
2647 | |||
2637 | { } /* terminate */ | 2648 | { } /* terminate */ |
2638 | }; | 2649 | }; |
2639 | 2650 | ||
diff --git a/kernel/cgroup/debug.c b/kernel/cgroup/debug.c index 9caeda610249..5f1b87330bee 100644 --- a/kernel/cgroup/debug.c +++ b/kernel/cgroup/debug.c | |||
@@ -373,11 +373,9 @@ struct cgroup_subsys debug_cgrp_subsys = { | |||
373 | * On v2, debug is an implicit controller enabled by "cgroup_debug" boot | 373 | * On v2, debug is an implicit controller enabled by "cgroup_debug" boot |
374 | * parameter. | 374 | * parameter. |
375 | */ | 375 | */ |
376 | static int __init enable_cgroup_debug(char *str) | 376 | void __init enable_debug_cgroup(void) |
377 | { | 377 | { |
378 | debug_cgrp_subsys.dfl_cftypes = debug_files; | 378 | debug_cgrp_subsys.dfl_cftypes = debug_files; |
379 | debug_cgrp_subsys.implicit_on_dfl = true; | 379 | debug_cgrp_subsys.implicit_on_dfl = true; |
380 | debug_cgrp_subsys.threaded = true; | 380 | debug_cgrp_subsys.threaded = true; |
381 | return 1; | ||
382 | } | 381 | } |
383 | __setup("cgroup_debug", enable_cgroup_debug); | ||