Skip to content

Commit 8cc38fa

Browse files
committed
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>
1 parent 575313f commit 8cc38fa

1 file changed

Lines changed: 56 additions & 3 deletions

File tree

‎kernel/cgroup/debug.c‎

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ static u64 releasable_read(struct cgroup_subsys_state *css, struct cftype *cft)
240240
!css_has_online_children(&css->cgroup->self));
241241
}
242242

243-
static struct cftype debug_files[] = {
243+
static struct cftype debug_legacy_files[] = {
244244
{
245245
.name = "taskcount",
246246
.read_u64 = debug_taskcount_read,
@@ -287,9 +287,62 @@ static struct cftype debug_files[] = {
287287
{ } /* terminate */
288288
};
289289

290+
static 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+
290332
struct cgroup_subsys debug_cgrp_subsys = {
291333
.css_alloc = debug_css_alloc,
292334
.css_free = debug_css_free,
293-
.legacy_cftypes = debug_files,
294-
.dfl_cftypes = debug_files,
335+
.legacy_cftypes = debug_legacy_files,
295336
};
337+
338+
/*
339+
* On v2, debug is an implicit controller enabled by "cgroup_debug" boot
340+
* parameter.
341+
*/
342+
static 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);

0 commit comments

Comments
 (0)