Skip to content

Commit af000ce

Browse files
Werkovhtejun
authored andcommitted
cgroup: Do not report unavailable v1 controllers in /proc/cgroups
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ý <mkoutny@suse.com> Reviewed-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 3c41382 commit af000ce

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

kernel/cgroup/cgroup-v1.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,14 @@ int proc_cgroupstats_show(struct seq_file *m, void *v)
681681
* cgroup_mutex contention.
682682
*/
683683

684-
for_each_subsys(ss, i)
684+
for_each_subsys(ss, i) {
685+
if (cgroup1_subsys_absent(ss))
686+
continue;
685687
seq_printf(m, "%s\t%d\t%d\t%d\n",
686688
ss->legacy_name, ss->root->hierarchy_id,
687689
atomic_read(&ss->root->nr_cgrps),
688690
cgroup_ssid_enabled(i));
691+
}
689692

690693
return 0;
691694
}

0 commit comments

Comments
 (0)