summaryrefslogtreecommitdiff
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2026-09-30 11:48:00 -0400
committerTejun Heo <tj@kernel.org>2026-09-30 07:26:09 -1000
commit5ffe20411787dd9947a35669ef8cb9484053efcf (patch)
treed61e06df5b0905c634e00628f11673062cd1c990 /tools/testing/selftests
parenta6d4aee572e81144d6f0867a9c1af3020869d406 (diff)
downloadlinux-next-5ffe20411787dd9947a35669ef8cb9484053efcf.tar.gz
linux-next-5ffe20411787dd9947a35669ef8cb9484053efcf.zip
cgroup/cpuset: Use cpuset_v2() in cpuset_num_cpus()
The cpuset code has 2 different helpers for determining if it is in a v1 or v2 working environment - cpuset_v2() and is_in_v2_mode(). cpuset_v2() checks the binding of the cpuset subsystem is on a v1 or v2 hierarchy. It can also help to optimize out v1 specific code if CONFIG_CPUSETS_V1 isn't defined. is_in_v2_mode() layers on top of cpuset_v2() and returns true if it is in a v2 hierarchy or in a v1 hierarchy with "cpuset_v2_mode" mount option enabled to make "cpuset.cpus" and "cpuset.mems" behave in a way similar to their v2 counterparts. However the cpuset hierarchy may still be a standalone one separated from the other cgroup hierarchies. Commit 90ac22ffef48 ("sched/fair: Add cgroup_mode: max") adds a new cpuset_num_cpus() helper to return the number of effective CPUs in a given cgroup. It is part of the "sched: Flatten the pick" patch series to help flatten the cpu cgroup runqueue hierarchies. cpuset_num_cpus() currently uses is_in_v2_mode() to determine if it is in a v2 environment. However is_in_v2_mode() can be true in a v1 environment where the cpuset and cpu cgroup subsystems can be in two separate hierarchies. The current use case [1] for cpuset_num_cpus() assumes that it can return the number of effective CPUs present in the current cpu cgroup which may not be the case. Fix that by switching to use cpuset_v2() which signifies that it is in a unified hierarchy where both cpuset and cpu cgroup subsystems share the same cgroup hierarchy if it returns true. [1] https://lore.kernel.org/lkml/20260930081125.GF88198@noisy.programming.kicks-ass.net Fixes: 90ac22ffef48 ("sched/fair: Add cgroup_mode: max") Signed-off-by: Waiman Long <longman@redhat.com> Reviewed-by: Andrea Righi <arighi@nvidia.com> Reviewed-by: Michal Koutný <mkoutny@suse.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/testing/selftests')
0 files changed, 0 insertions, 0 deletions