Add early-boot-safety check to cond_resched()
authorLinus Torvalds <torvalds@g5.osdl.org>
Tue, 7 Mar 2006 01:38:49 +0000 (17:38 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 7 Mar 2006 01:38:49 +0000 (17:38 -0800)
Just to be safe, we should not trigger a conditional reschedule during
the early boot sequence.  We've historically done some questionable
early on, and the safety warnings in __might_sleep() are generally
turned off during that period, so there might be problems lurking.

This affects CONFIG_PREEMPT_VOLUNTARY, which takes over might_sleep() to
cause a voluntary conditional reschedule.

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/sched.c

index 12d291bf3379a38c94d11e600bdb1455781f3d01..3454bb869fd068c070e8fbf219e981018305df99 100644 (file)
@@ -4028,6 +4028,8 @@ static inline void __cond_resched(void)
         */
        if (unlikely(preempt_count()))
                return;
+       if (unlikely(system_state != SYSTEM_RUNNING))
+               return;
        do {
                add_preempt_count(PREEMPT_ACTIVE);
                schedule();