From: Linus Torvalds Date: Tue, 7 Mar 2006 01:38:49 +0000 (-0800) Subject: Add early-boot-safety check to cond_resched() X-Git-Tag: v3.12-rc1~38181 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ba7b0a14b2ec19583bedbcdbea7f1c5008fc922;p=kernel%2Fkernel-generic.git Add early-boot-safety check to cond_resched() 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 Signed-off-by: Linus Torvalds --- diff --git a/kernel/sched.c b/kernel/sched.c index 12d291b..3454bb8 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -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();