diff options
| author | Andrea Righi <arighi@nvidia.com> | 2026-09-30 11:00:18 +0200 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-09-30 13:56:26 -1000 |
| commit | e28807c846081ab04ba5eb77e588878ee3811961 (patch) | |
| tree | 1835c326b3b924be47642c8f3041d2503aeb97bb /tools/perf/scripts/python | |
| parent | da0946effa09ea937d971b6fab2d6e380048dbb4 (diff) | |
sched_ext: Introduce scx_bpf_cgroup_nr_cpus()
Hierarchical BPF schedulers may need to know how many CPUs a cgroup can
run on when distributing group-wide weights.
For example, fair's group share calculation scales a group's weight by
the smaller of its estimated runnable task count and the number of CPUs
in its effective cpuset. Without that count, a BPF scheduler can only
use the machine-wide CPU count and may give a group confined to a few
CPUs excessive shares.
A task's effective affinity can include per-task restrictions, so it
cannot reliably represent the group's cpuset. Reading the cpuset
directly from BPF would require CO-RE access to private cgroup and
cpuset structures, including inherited cpuset resolution, making the
approach fragile across kernel versions.
Add scx_bpf_cgroup_nr_cpus(), which returns the same count fair uses
through cpuset_num_cpus(). The count is independent of CPU or CID
numbering, so the kfunc is available to both cpu-form and cid-form
schedulers from any context. Also add a compat wrapper which falls
back to nr_cpu_ids on older kernels.
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
