sched: Check for idle task in might_sleep()
authorThomas Gleixner <tglx@linutronix.de>
Fri, 7 Feb 2014 19:58:38 +0000 (20:58 +0100)
committerIngo Molnar <mingo@kernel.org>
Sat, 22 Feb 2014 17:07:50 +0000 (18:07 +0100)
Idle is not allowed to call sleeping functions ever!

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1391803122-4425-3-git-send-email-bigeasy@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/core.c

index 06da865043ecbebe4c0280349dd18924a40e0d5c..a01fe6cfdb9b6935e4495512a843714d7ebe9498 100644 (file)
@@ -6927,7 +6927,8 @@ void __might_sleep(const char *file, int line, int preempt_offset)
        static unsigned long prev_jiffy;        /* ratelimiting */
 
        rcu_sleep_check(); /* WARN_ON_ONCE() by default, no rate limit reqd. */
-       if ((preempt_count_equals(preempt_offset) && !irqs_disabled()) ||
+       if ((preempt_count_equals(preempt_offset) && !irqs_disabled() &&
+            !is_idle_task(current)) ||
            system_state != SYSTEM_RUNNING || oops_in_progress)
                return;
        if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)