public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] make poll_idle behave more like the other idle methods
@ 2008-08-27 14:35 Joe Korty
  2008-08-28  9:00 ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Korty @ 2008-08-27 14:35 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Andrew Morton, Linux Kernel

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>

Index: 2.6.27-rc4-git4/arch/x86/kernel/process.c
===================================================================
--- 2.6.27-rc4-git4.orig/arch/x86/kernel/process.c	2008-08-26 17:44:34.000000000 -0400
+++ 2.6.27-rc4-git4/arch/x86/kernel/process.c	2008-08-26 18:22:19.000000000 -0400
@@ -185,7 +185,8 @@
 static void poll_idle(void)
 {
 	local_irq_enable();
-	cpu_relax();
+	while(!need_resched())
+		cpu_relax();
 }
 
 /*

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-08-28 15:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-27 14:35 [PATCH] make poll_idle behave more like the other idle methods Joe Korty
2008-08-28  9:00 ` Ingo Molnar
2008-08-28 10:40   ` Thomas Gleixner
2008-08-28 13:22   ` Joe Korty
2008-08-28 13:33     ` Ingo Molnar
2008-08-28 15:19       ` Joe Korty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox