sched: Reenable interrupts in do_sched_yield()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 20 Oct 2020 14:46:55 +0000 (16:46 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 29 Oct 2020 10:00:31 +0000 (11:00 +0100)
do_sched_yield() invokes schedule() with interrupts disabled which is
not allowed. This goes back to the pre git era to commit a6efb709806c
("[PATCH] irqlock patch 2.5.27-H6") in the history tree.

Reenable interrupts and remove the misleading comment which "explains" it.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/87r1pt7y5c.fsf@nanos.tec.linutronix.de
kernel/sched/core.c

index d2003a7..6f533bb 100644 (file)
@@ -6094,12 +6094,8 @@ static void do_sched_yield(void)
        schedstat_inc(rq->yld_count);
        current->sched_class->yield_task(rq);
 
-       /*
-        * Since we are going to call schedule() anyway, there's
-        * no need to preempt or enable interrupts:
-        */
        preempt_disable();
-       rq_unlock(rq, &rf);
+       rq_unlock_irq(rq, &rf);
        sched_preempt_enable_no_resched();
 
        schedule();