Commit 27f5b4f5 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Sebastian Andrzej Siewior
Browse files

sched: Prevent balance_push() on remote runqueues

sched_setscheduler() and rt_mutex_setprio() invoke the run-queue balance
callback after changing priorities or the scheduling class of a task. The
run-queue for which the callback is invoked can be local or remote.

That's not a problem for the regular rq::push_work which is serialized with
a busy flag in the run-queue struct, but for the balance_push() work which
is only valid to be invoked on the outgoing CPU that's wrong. It not only
triggers the debug warning, but also leaves the per CPU variable push_work
unprotected, which can result in double enqueues on the stop machine list.

Remove the warning and validate that the function is invoked on the
outgoing CPU.

Fixes: ae792702

 ("sched: Optimize finish_lock_switch()")
Reported-by: default avatarSebastian Siewior <>
Signed-off-by: default avatarThomas Gleixner <>
Cc: Juri Lelli <>
Cc: Vincent Guittot <>
Cc: Peter Zijlstra <>
Cc: Steven Rostedt <>
Cc: Ben Segall <>
Cc: Ingo Molnar <>
Cc: Mel Gorman <>
Cc: Daniel Bristot de Oliveira <>
Cc: Dietmar Eggemann <>
Signed-off-by: default avatarSebastian Andrzej Siewior <>
parent be20d1c4
......@@ -8686,7 +8686,7 @@ static void balance_push(struct rq *rq)
* Only active while going offline and when invoked on the outgoing
* CPU.
if (!cpu_dying(rq->cpu) && rq == this_rq())
if (!cpu_dying(rq->cpu) || rq != this_rq())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment