Skip to content

Commit 5ce4761

Browse files
Libo ChenJohn Donnelly
authored andcommitted
sched: restore the sliding search window for select_idle_cpu()
Commit d8ff690 ("sched/fair: Optimize select_idle_cpu") dropped a per_cpu assignment and replaced "target_tmp" with "target" as the starting cpu in for_each_cpu_wrap(), both of which were originally introduced in commit 7a0590a ("sched: rotate the cpu search window for better spread"). Adding them back allows the per-cpu search window to move based on the last search result not the target CPU. Target CPUs may not be uniformly spreading out due to, for example, certain IRQ bindings. Fixes: d8ff690 ("sched/fair: Optimize select_idle_cpu") Orabug: 33965297 Signed-off-by: Libo Chen <[email protected]> Reviewed-by: Chris Hyser <[email protected]> Signed-off-by: John Donnelly <[email protected]>
1 parent ac865cd commit 5ce4761

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/sched/fair.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5866,7 +5866,8 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
58665866

58675867
cpumask_and(cpus, sched_domain_span(sd), &p->cpus_allowed);
58685868

5869-
for_each_cpu_wrap(cpu, cpus, target) {
5869+
for_each_cpu_wrap(cpu, cpus, target_tmp) {
5870+
per_cpu(next_cpu, target) = cpu;
58705871
if (!--nr)
58715872
return -1;
58725873
if (idle_cpu(cpu))

0 commit comments

Comments
 (0)