cgroup: Do not report unavailable v1 controllers in /proc/cgroups

JIRA: https://issues.redhat.com/browse/RHEL-80382

commit af000ce85293b8e608f696f0c6c280bc3a75887f
Author: Michal Koutný <mkoutny@suse.com>
Date:   Mon Sep 9 18:32:23 2024 +0200

    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>

Signed-off-by: Radostin Stoyanov <rstoyano@redhat.com>
This commit is contained in:
Radostin Stoyanov 2025-03-27 12:21:20 +00:00
parent b16f7d3e66
commit 3a901bcc52
1 changed files with 4 additions and 1 deletions

View 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;
}