]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched/topology: Allow multiple domains to claim sched_domain_shared
authorK Prateek Nayak <kprateek.nayak@amd.com>
Tue, 19 May 2026 05:14:23 +0000 (05:14 +0000)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 19 May 2026 11:35:36 +0000 (13:35 +0200)
commit9e005ed21152d4a4bb0ceea71045ff8a642a6feb
treeaa9b6e6e843e2d321b16ef2ac811a110a27a592f
parenta26d9208c1376ac3877d9f12e697f83368e2af1c
sched/topology: Allow multiple domains to claim sched_domain_shared

Recent optimizations of sd->shared assignment moved to allocating a
single instance of per-CPU sched_domain_shared objects per s_data.

Recent optimizations to select_idle_capacity() moved the sd->shared
assignments to "sd_asym" domain when ASYM_CPUCAPACITY is detected but
cache-aware scheduling mandates the presence of "sd_llc_shared" to
compute and cache per-LLC statistics.

Use an "alloc_flags" union in sched_domain_shared to claim a
sched_domain_shared object per sched_domain. Allocation starts searching
for an available / matching sched_domain_shared instance from the first
CPU of sched_domain_span(sd) (sd can be sd_llc, or sd_asym). If the
shared object is claimed by another domain, the instance corresponding
to next CPU in the domain span is explored until a matching / available
instance is found.

In case of a single CPU in sched_domain_span(), the domain will be
degenerated and a temporary overlap of ->shared objects across different
domains is acceptable.

"alloc_flags" forms a union with "nr_idle_scan" and the stale flags are
left as is when the sd->shared is published. The expectation is for the
first load balancing instance to correct the value just like the current
behavior, except the initial value is no longer 0.

Originally-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Andrea Righi <arighi@nvidia.com>
include/linux/sched/topology.h
kernel/sched/topology.c