Skip to content

Commit 2c7e9fd

Browse files
Joe KortyIngo Molnar
authored andcommitted
x86: make poll_idle behave more like the other idle methods
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 4c246ed commit 2c7e9fd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kernel/process.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ static void mwait_idle(void)
185185
static void poll_idle(void)
186186
{
187187
local_irq_enable();
188-
cpu_relax();
188+
while (!need_resched())
189+
cpu_relax();
189190
}
190191

191192
/*

0 commit comments

Comments
 (0)