Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ba7b0a1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 91c0bce2
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -4028,6 +4028,8 @@ static inline void __cond_resched(void)
	 */
	 */
	if (unlikely(preempt_count()))
	if (unlikely(preempt_count()))
		return;
		return;
	if (unlikely(system_state != SYSTEM_RUNNING))
		return;
	do {
	do {
		add_preempt_count(PREEMPT_ACTIVE);
		add_preempt_count(PREEMPT_ACTIVE);
		schedule();
		schedule();