]> Git Repo - J-linux.git/commitdiff
cgroup: Do not report unavailable v1 controllers in /proc/cgroups
authorMichal Koutný <[email protected]>
Mon, 9 Sep 2024 16:32:23 +0000 (18:32 +0200)
committerTejun Heo <[email protected]>
Tue, 10 Sep 2024 20:04:28 +0000 (10:04 -1000)
This is a followup to CONFIG-urability of cpuset and memory controllers
for v1 hierarchies. Make the output in /proc/cgroups reflect that
!CONFIG_CPUSETS_V1 is like !CONFIG_CPUSETS and
!CONFIG_MEMCG_V1 is like !CONFIG_MEMCG.

The intended effect is that hiding the unavailable controllers will hint
users not to try mounting them on v1.

Signed-off-by: Michal Koutný <[email protected]>
Reviewed-by: Waiman Long <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
kernel/cgroup/cgroup-v1.c

index 784337694a4be084c31fed89031959495096448b..e28d5f0d20ed09e439b98bd21c83995bc0e55242 100644 (file)
@@ -681,11 +681,14 @@ int proc_cgroupstats_show(struct seq_file *m, void *v)
         * cgroup_mutex contention.
         */
 
-       for_each_subsys(ss, i)
+       for_each_subsys(ss, i) {
+               if (cgroup1_subsys_absent(ss))
+                       continue;
                seq_printf(m, "%s\t%d\t%d\t%d\n",
                           ss->legacy_name, ss->root->hierarchy_id,
                           atomic_read(&ss->root->nr_cgrps),
                           cgroup_ssid_enabled(i));
+       }
 
        return 0;
 }
This page took 0.065393 seconds and 4 git commands to generate.