• Mike Galbraith's avatar
    sched: fix __sched_setscheduler() vs load balancing race · 34bce199
    Mike Galbraith authored
    __sched_setscheduler() may release rq->lock in pull_rt_task() as a task is
    being changed rt -> fair class.  load balancing may sneak in, move the task
    behind __sched_setscheduler()'s back, which explodes in switched_to_fair()
    when the passed but no longer valid rq is used.  Tell can_migrate_task() to
    say no if ->pi_lock is held.
    
    @stable: Kernels that predate SCHED_DEADLINE can use this simple (and tested)
    check in lieu of backport of the full 18 patch mainline treatment.
    Signed-off-by: default avatarMike Galbraith <umgwanakikbuti@gmail.com>
    [bwh: Backported to 3.2:
     - Adjust numbering in the comment
     - Adjust filename]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    Cc: Byungchul Park <byungchul.park@lge.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Willy Tarreau <w@1wt.eu>
    34bce199
sched_fair.c 131 KB