aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2017-06-14 16:01:32 -0400
committerTejun Heo <tj@kernel.org>2017-06-14 16:01:32 -0400
commit8cc38fa7fa317d44710f24475576b1f9ee205da9 (patch)
treed5390c1d904a901a94992e7c0075971bf399baf5
parent575313f40ff33d0c2aff2701dfb2ccfcd6211d55 (diff)
cgroup: make debug an implicit controller on cgroup2
Make debug an implicit controller on cgroup2 which is enabled by "cgroup_debug" boot param. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Waiman Long <longman@redhat.com>
-rw-r--r--kernel/cgroup/debug.c59
1 files changed, 56 insertions, 3 deletions
diff --git a/kernel/cgroup/debug.c b/kernel/cgroup/debug.c
index 057d9b07f461..d61e692a5338 100644
--- a/kernel/cgroup/debug.c
+++ b/kernel/cgroup/debug.c
@@ -240,7 +240,7 @@ static u64 releasable_read(struct cgroup_subsys_state *css, struct cftype *cft)
240 !css_has_online_children(&css->cgroup->self)); 240 !css_has_online_children(&css->cgroup->self));
241} 241}
242 242
243static struct cftype debug_files[] = { 243static struct cftype debug_legacy_files[] = {
244 { 244 {
245 .name = "taskcount", 245 .name = "taskcount",
246 .read_u64 = debug_taskcount_read, 246 .read_u64 = debug_taskcount_read,
@@ -287,9 +287,62 @@ static struct cftype debug_files[] = {
287 { } /* terminate */ 287 { } /* terminate */
288}; 288};
289 289
290static struct cftype debug_files[] = {
291 {
292 .name = "taskcount",
293 .read_u64 = debug_taskcount_read,
294 },
295
296 {
297 .name = "current_css_set",
298 .seq_show = current_css_set_read,
299 .flags = CFTYPE_ONLY_ON_ROOT,
300 },
301
302 {
303 .name = "current_css_set_refcount",
304 .read_u64 = current_css_set_refcount_read,
305 .flags = CFTYPE_ONLY_ON_ROOT,
306 },
307
308 {
309 .name = "current_css_set_cg_links",
310 .seq_show = current_css_set_cg_links_read,
311 .flags = CFTYPE_ONLY_ON_ROOT,
312 },
313
314 {
315 .name = "css_links",
316 .seq_show = cgroup_css_links_read,
317 },
318
319 {
320 .name = "csses",
321 .seq_show = cgroup_subsys_states_read,
322 },
323
324 {
325 .name = "masks",
326 .seq_show = cgroup_masks_read,
327 },
328
329 { } /* terminate */
330};
331
290struct cgroup_subsys debug_cgrp_subsys = { 332struct cgroup_subsys debug_cgrp_subsys = {
291 .css_alloc = debug_css_alloc, 333 .css_alloc = debug_css_alloc,
292 .css_free = debug_css_free, 334 .css_free = debug_css_free,
293 .legacy_cftypes = debug_files, 335 .legacy_cftypes = debug_legacy_files,
294 .dfl_cftypes = debug_files,
295}; 336};
337
338/*
339 * On v2, debug is an implicit controller enabled by "cgroup_debug" boot
340 * parameter.
341 */
342static int __init enable_cgroup_debug(char *str)
343{
344 debug_cgrp_subsys.dfl_cftypes = debug_files;
345 debug_cgrp_subsys.implicit_on_dfl = true;
346 return 1;
347}
348__setup("cgroup_debug", enable_cgroup_debug);