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 <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Linus Torvalds 2006-03-06 17:38:49 -08:00
parent 91c0bce29e
commit 8ba7b0a14b
1 changed files with 2 additions and 0 deletions

View 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();