Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched/fair: Use READ_ONCE() to read sg->asym_prefer_cpu

Subsequent commits add the support to dynamically update the sched_group
struct's "asym_prefer_cpu" member from a remote CPU. Use READ_ONCE()
when reading the "sg->asym_prefer_cpu" to ensure load balancer always
reads the latest value.

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-2-kprateek.nayak@amd.com

authored by

K Prateek Nayak and committed by
Peter Zijlstra
872aa4de 6432e163

+3 -2
+3 -2
kernel/sched/fair.c
··· 10251 10251 (sgs->group_weight - sgs->idle_cpus != 1)) 10252 10252 return false; 10253 10253 10254 - return sched_asym(env->sd, env->dst_cpu, group->asym_prefer_cpu); 10254 + return sched_asym(env->sd, env->dst_cpu, READ_ONCE(group->asym_prefer_cpu)); 10255 10255 } 10256 10256 10257 10257 /* One group has more than one SMT CPU while the other group does not */ ··· 10488 10488 10489 10489 case group_asym_packing: 10490 10490 /* Prefer to move from lowest priority CPU's work */ 10491 - return sched_asym_prefer(sds->busiest->asym_prefer_cpu, sg->asym_prefer_cpu); 10491 + return sched_asym_prefer(READ_ONCE(sds->busiest->asym_prefer_cpu), 10492 + READ_ONCE(sg->asym_prefer_cpu)); 10492 10493 10493 10494 case group_misfit_task: 10494 10495 /*