]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched/topology: Introduce sched_update_asym_prefer_cpu()
authorK Prateek Nayak <kprateek.nayak@amd.com>
Wed, 9 Apr 2025 05:34:44 +0000 (05:34 +0000)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 16 Apr 2025 19:09:11 +0000 (21:09 +0200)
commit0e3f6c3696424fa90d6f512779d617a05a1cf031
tree5611d971f27e1f76324ef140770ba16e265ce8e2
parent872aa4de18889be63317a8c0f2de71a3a01e487c
sched/topology: Introduce sched_update_asym_prefer_cpu()

A subset of AMD Processors supporting Preferred Core Rankings also
feature the ability to dynamically switch these rankings at runtime to
bias load balancing towards or away from the LLC domain with larger
cache.

To support dynamically updating "sg->asym_prefer_cpu" without needing to
rebuild the sched domain, introduce sched_update_asym_prefer_cpu() which
recomutes the "asym_prefer_cpu" when the core-ranking of a CPU changes.

sched_update_asym_prefer_cpu() swaps the "sg->asym_prefer_cpu" with the
CPU whose ranking has changed if the new ranking is greater than that of
the "asym_prefer_cpu". If CPU whose ranking has changed is the current
"asym_prefer_cpu", it scans the CPUs of the sched groups to find the new
"asym_prefer_cpu" and sets it accordingly.

get_group() for non-overlapping sched domains returns the sched group
for the first CPU in the sched_group_span() which ensures all CPUs in
the group see the updated value of "asym_prefer_cpu".

Overlapping groups are allocated differently and will require moving the
"asym_prefer_cpu" to "sg->sgc" but since the current implementations do
not set "SD_ASYM_PACKING" at NUMA domains, skip additional
indirection and place a SCHED_WARN_ON() to alert any future users.

Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250409053446.23367-3-kprateek.nayak@amd.com
include/linux/sched/topology.h
kernel/sched/topology.c