Skip to content

Commit bbf18b1

Browse files
Prashanth NageshappaIngo Molnar
authored andcommitted
sched: Reset loop counters if all tasks are pinned and we need to redo load balance
While load balancing, if all tasks on the source runqueue are pinned, we retry after excluding the corresponding source cpu. However, loop counters env.loop and env.loop_break are not reset before retrying, which can lead to failure in moving the tasks. In this patch we reset env.loop and env.loop_break to their inital values before we retry. Signed-off-by: Prashanth Nageshappa <prashanth@linux.vnet.ibm.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/4FE06EEF.2090709@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 85c1e7d commit bbf18b1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernel/sched/fair.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4288,8 +4288,11 @@ static int load_balance(int this_cpu, struct rq *this_rq,
42884288
/* All tasks on this runqueue were pinned by CPU affinity */
42894289
if (unlikely(env.flags & LBF_ALL_PINNED)) {
42904290
cpumask_clear_cpu(cpu_of(busiest), cpus);
4291-
if (!cpumask_empty(cpus))
4291+
if (!cpumask_empty(cpus)) {
4292+
env.loop = 0;
4293+
env.loop_break = sched_nr_migrate_break;
42924294
goto redo;
4295+
}
42934296
goto out_balanced;
42944297
}
42954298
}

0 commit comments

Comments
 (0)