Skip to content

Commit 5de4fa1

Browse files
committed
cgroup: initialize cgrp_dfl_root_inhibit_ss_mask from !->dfl_files test
cgrp_dfl_root_inhibit_ss_mask determines which subsystems are not supported on the default hierarchy and is currently initialized statically and just includes the debug subsystem. Now that there's cgroup_subsys->dfl_files, we can easily tell which subsystems support the default hierarchy or not. Let's initialize cgrp_dfl_root_inhibit_ss_mask by testing whether cgroup_subsys->dfl_files is NULL. After all, subsystems with NULL ->dfl_files aren't useable on the default hierarchy anyway. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
1 parent 05ebb6e commit 5de4fa1

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎kernel/cgroup.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,7 @@ static bool cgrp_dfl_root_visible;
156156
static bool cgroup_legacy_files_on_dfl;
157157

158158
/* some controllers are not supported in the default hierarchy */
159-
static const unsigned int cgrp_dfl_root_inhibit_ss_mask = 0
160-
#ifdef CONFIG_CGROUP_DEBUG
161-
| (1 << debug_cgrp_id)
162-
#endif
163-
;
159+
static unsigned int cgrp_dfl_root_inhibit_ss_mask;
164160

165161
/* The list of hierarchy roots */
166162

@@ -4939,6 +4935,9 @@ int __init cgroup_init(void)
49394935
if (cgroup_legacy_files_on_dfl && !ss->dfl_cftypes)
49404936
ss->dfl_cftypes = ss->legacy_cftypes;
49414937

4938+
if (!ss->dfl_cftypes)
4939+
cgrp_dfl_root_inhibit_ss_mask |= 1 << ss->id;
4940+
49424941
if (ss->dfl_cftypes == ss->legacy_cftypes) {
49434942
WARN_ON(cgroup_add_cftypes(ss, ss->dfl_cftypes));
49444943
} else {

0 commit comments

Comments
 (0)