Skip to contentSkip to conversation

migh_sleep during early boot

PATCH Manfred Spraul 1 participant 1 message Oct 18, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

With might_sleep reports several calls from invalid contexts during early boot:

First some calls due to irq off, preempt off: This are the first stages of start_kernel, irqs are not yet enabled. Then calls with only preemption off: The kernel runs on the future idle thread, and these threads have preempt_count==1.

Attached is a patch that fixes the latter bug: ignore the preemption counter for the idle threads. I haven't figured out how to identify the calls before the first local_irq_enable().

--
Manfred

kernel/sched.c +1 -1
@@ -2848,7 +2848,7 @@
 #if defined(in_atomic)
 	static unsigned long prev_jiffy;	/* ratelimiting */
 
-	if (in_atomic() || irqs_disabled()) {
+	if ((in_atomic() && current->pid) || irqs_disabled()) {
 		if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
 			return;
 		prev_jiffy = jiffies;