Commit 8bcd4dcd authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] acpi_processor_idle() latency fix

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: default avatarIngo Molnar <mingo@elte.hu>
Cc: "Brown, Len" <len.brown@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 27efb93b
...@@ -353,6 +353,15 @@ acpi_processor_idle (void) ...@@ -353,6 +353,15 @@ acpi_processor_idle (void)
*/ */
local_irq_disable(); 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]); cx = &(pr->power.states[pr->power.state]);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment