Re: [PATCH v3 3/7] sched/fair: Add cgroup_mode: max

From: Waiman Long

Date: Thu Jun 11 2026 - 16:57:37 EST


On 6/11/26 9:47 AM, Peter Zijlstra wrote:
On Wed, Jun 10, 2026 at 11:09:59AM -0400, Waiman Long wrote:

--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -4116,6 +4116,21 @@ bool cpuset_cpus_allowed_fallback(struct
return changed;
}
+int cpuset_num_cpus(struct cgroup *cgrp)
+{
+ int nr = num_online_cpus();
+ struct cpuset *cs;
+
+ if (is_in_v2_mode()) {
+ guard(rcu)();
+ cs = css_cs(cgroup_e_css(cgrp, &cpuset_cgrp_subsys));
+ if (cs)
+ nr = cpumask_weight(cs->effective_cpus);
+ }
+
+ return nr;
+}
I just have a question about cgroup v1 support. I am assuming that cgroup v1
without the cpuset_v2_mode mount option is not supported.
Correct.

To fully support
cgroup v1, you may have to use guarantee_active_cpus() to return the actual
set of CPUs that the task can run on.
Except this is group based, we'd need an iteration of all tasks in the
group and compute a union of guarantee_active_cpus(). Which all seems
far too expensive and not worth the effort.
I thought so.

Also there is a caveat about the arm64 specific
task_cpu_possible_mask() for certain arm64 CPUs. That is for 32-bit
binary running on 64-bit core which are allowed only on a selected
subset of cores within the CPU.

This is probably not what you want to focus on right now, but it will be
good to have a comment to list items that are not fully supported here.
Will add a comment!
Thanks,
Longman