[PATCH] Add cpu_relax in idle spin loop for no-hlt kernel option

From: Fenghua Yu
Date: Fri Dec 03 2004 - 19:27:15 EST


If given no-hlt kernel option, ia32 idle loop turns out to be a spin loop.
Add cpu_relax() in this spin loop because IA32 SDM recommends that a PAUSE
instruction be put in all spin loops.

The patch is against 2.6.9 kernel.

Signed-off-by: Fenghua Yu <fenghua.yu@xxxxxxxxx>

diff -Nurp a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c 2004-10-18 14:53:05.000000000 -0700
+++ b/arch/i386/kernel/process.c 2004-12-02 18:04:43.000000000 -0800
@@ -97,6 +97,8 @@ void default_idle(void)
else
local_irq_enable();
}
+ else
+ cpu_relax();
}

/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/