x86: make poll_idle behave more like the other idle methods
authorJoe Korty <joe.korty@ccur.com>
Wed, 27 Aug 2008 14:35:06 +0000 (10:35 -0400)
committerIngo Molnar <mingo@elte.hu>
Thu, 28 Aug 2008 09:29:48 +0000 (11:29 +0200)
Make poll_idle() behave more like the other idle methods.

Currently, poll_idle() returns immediately.  The other
idle methods all wait indefinately for some condition
to come true before returning.  poll_idle should emulate
these other methods and also wait for a return condition,
in this case, for need_resched() to become 'true'.

Without this delay the idle loop spends all of its time
in the outer loop that calls poll_idle.  This outer loop,
these days, does real work, some of it under rcu locks.
That work should only be done when idle is entered and
when idle exits, not continuously while idle is spinning.

Signed-off-by: Joe Korty <joe.korty@ccur.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/process.c

index 7fc4d5b0a6a0f99a4d1d9c4df685a5a4d3a135bb..4e09d26748cfc6706e5ff9df932767f26398e2be 100644 (file)
@@ -185,7 +185,8 @@ static void mwait_idle(void)
 static void poll_idle(void)
 {
        local_irq_enable();
-       cpu_relax();
+       while (!need_resched())
+               cpu_relax();
 }
 
 /*