Re: [PATCH-cgroup v4] cgroup: Show # of subsystem CSSes in cgroup.stat

From: Waiman Long
Date: Fri Jul 26 2024 - 16:42:21 EST


On 7/26/24 16:40, Waiman Long wrote:


On 7/26/24 04:19, Michal Koutný wrote:
+ for_each_css(css, ssid, cgroup) {
+ if ((BIT(ssid) & cgrp_dfl_inhibit_ss_mask) ||
+ (cgroup_subsys[ssid]->root != &cgrp_dfl_root))
+ continue;
Is this taken? (Given cgroup.stat is only on the default hierarchy.)
I am not sure what you are asking here. Since cgroup.stat is a cgroup v2
only control file, it won't show subsystems that are bound to cgroup v1.
So, is the if (...) ever true? (The file won't exist on v1.)

A mixed cgroup v1/v2 environment is allowed, though not encouraged. We can have some cgroup controllers bound to cgroup v2 and the rests to cgroup v1. It is in this case that cgroup.stat will only show those that are with cgroup v2.

Regards,
Longman