Skip to content
  • Thomas Gleixner's avatar
    sched: Prevent balance_push() on remote runqueues · 27f5b4f5
    Thomas Gleixner authored
    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 <bigeasy@linutronix.de>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Cc: Juri Lelli <juri.lelli@redhat.com>
    Cc: Vincent Guittot <vincent.guittot@linaro.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Ben Segall <bsegall@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
    Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
    Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
    Link: https://lore.kernel.org/r/87zgt1hdw7.ffs@tglx
    27f5b4f5