Skip to content

Commit

Permalink
x86: make poll_idle behave more like the other idle methods
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joe Korty authored and Ingo Molnar committed Aug 28, 2008
1 parent 4c246ed commit 2c7e9fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/x86/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ static void mwait_idle(void)
static void poll_idle(void)
{
local_irq_enable();
cpu_relax();
while (!need_resched())
cpu_relax();
}

/*
Expand Down

0 comments on commit 2c7e9fd

Please sign in to comment.