aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/process.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 5e95b257ee26..49f7fac6229e 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -238,20 +238,28 @@ void cpu_idle (void)
238 * We execute MONITOR against need_resched and enter optimized wait state 238 * We execute MONITOR against need_resched and enter optimized wait state
239 * through MWAIT. Whenever someone changes need_resched, we would be woken 239 * through MWAIT. Whenever someone changes need_resched, we would be woken
240 * up from MWAIT (without an IPI). 240 * up from MWAIT (without an IPI).
241 *
242 * New with Core Duo processors, MWAIT can take some hints based on CPU
243 * capability.
241 */ 244 */
242static void mwait_idle(void) 245void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
243{ 246{
244 local_irq_enable(); 247 if (!need_resched()) {
245
246 while (!need_resched()) {
247 __monitor((void *)&current_thread_info()->flags, 0, 0); 248 __monitor((void *)&current_thread_info()->flags, 0, 0);
248 smp_mb(); 249 smp_mb();
249 if (need_resched()) 250 if (!need_resched())
250 break; 251 __mwait(eax, ecx);
251 __mwait(0, 0);
252 } 252 }
253} 253}
254 254
255/* Default MONITOR/MWAIT with no hints, used for default C1 state */
256static void mwait_idle(void)
257{
258 local_irq_enable();
259 while (!need_resched())
260 mwait_idle_with_hints(0,0);
261}
262
255void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) 263void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
256{ 264{
257 static int printed; 265 static int printed;