We check need_resched() _before_ disabling preemption. This opens up the
following scenario:
swapper: !need_resched()
[IRQ context]
wakes up a task
marks idle task as need-resched
swapper: acpi_processor_idle(); // sleeps until next irq
instant 1msec latency introduced...
normally default_idle() is safe because it re-checks need_resched with
interrupts disabled before it truly halts the CPU. But
acpi_processor_idle() doesnt seem to be doing this! Your trace clearly
shows a missed preemption due to ACPI. I'm wondering why no-one has
triggered this before, it's a really bad bug that should be fixed in
2.6.10.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: "Brown, Len" <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
*/
local_irq_disable();
+ /*
+ * Check whether we truly need to go idle, or should
+ * reschedule:
+ */
+ if (unlikely(need_resched())) {
+ local_irq_enable();
+ return;
+ }
+
cx = &(pr->power.states[pr->power.state]);
/*