cgroup: initialize cgrp_dfl_root_inhibit_ss_mask from !->dfl_files test
authorTejun Heo <tj@kernel.org>
Tue, 15 Jul 2014 15:05:10 +0000 (11:05 -0400)
committerTejun Heo <tj@kernel.org>
Tue, 15 Jul 2014 15:05:10 +0000 (11:05 -0400)
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>
kernel/cgroup.c

index f41d164a3d54492661eedd41d5a2f253fc1bebf0..f2a6795e695be2ab432a7add3a26b7f7d319fd86 100644 (file)
@@ -156,11 +156,7 @@ static bool cgrp_dfl_root_visible;
 static bool cgroup_legacy_files_on_dfl;
 
 /* some controllers are not supported in the default hierarchy */
-static const unsigned int cgrp_dfl_root_inhibit_ss_mask = 0
-#ifdef CONFIG_CGROUP_DEBUG
-       | (1 << debug_cgrp_id)
-#endif
-       ;
+static unsigned int cgrp_dfl_root_inhibit_ss_mask;
 
 /* The list of hierarchy roots */
 
@@ -4939,6 +4935,9 @@ int __init cgroup_init(void)
                if (cgroup_legacy_files_on_dfl && !ss->dfl_cftypes)
                        ss->dfl_cftypes = ss->legacy_cftypes;
 
+               if (!ss->dfl_cftypes)
+                       cgrp_dfl_root_inhibit_ss_mask |= 1 << ss->id;
+
                if (ss->dfl_cftypes == ss->legacy_cftypes) {
                        WARN_ON(cgroup_add_cftypes(ss, ss->dfl_cftypes));
                } else {