Skip to content

Commit 872aa4d

Browse files
kudureranganathPeter Zijlstra
authored andcommitted
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6432e16 commit 872aa4d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kernel/sched/fair.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10251,7 +10251,7 @@ sched_group_asym(struct lb_env *env, struct sg_lb_stats *sgs, struct sched_group
1025110251
(sgs->group_weight - sgs->idle_cpus != 1))
1025210252
return false;
1025310253

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));
1025510255
}
1025610256

1025710257
/* One group has more than one SMT CPU while the other group does not */
@@ -10488,7 +10488,8 @@ static bool update_sd_pick_busiest(struct lb_env *env,
1048810488

1048910489
case group_asym_packing:
1049010490
/* 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));
1049210493

1049310494
case group_misfit_task:
1049410495
/*

0 commit comments

Comments
 (0)