From: Olof Johansson <olof@austin.ibm.com>

A smt_snooze_delay of 0 is supposed to mean "disabled", but current idle
loop logic doesn't take that into account and snoozes immediately instead.

Below patch fixes the logic in the idle loop, as well as cleans up the test
a bit.  An idling processor might no longer see a snooze change
immediately, but that's not needed anyway.


---

 25-akpm/arch/ppc64/kernel/idle.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff -puN arch/ppc64/kernel/idle.c~ppc64-smt-snooze-fix arch/ppc64/kernel/idle.c
--- 25/arch/ppc64/kernel/idle.c~ppc64-smt-snooze-fix	2004-03-25 00:39:54.529480592 -0800
+++ 25-akpm/arch/ppc64/kernel/idle.c	2004-03-25 00:39:54.531480288 -0800
@@ -172,16 +172,16 @@ int dedicated_idle(void)
 		oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED);
 		if (!oldval) {
 			set_thread_flag(TIF_POLLING_NRFLAG);
-			start_snooze = __get_tb();
+			start_snooze = __get_tb() +
+				naca->smt_snooze_delay*tb_ticks_per_usec;
 			while (!need_resched()) {
 				/* need_resched could be 1 or 0 at this 
 				 * point.  If it is 0, set it to 0, so
 				 * an IPI/Prod is sent.  If it is 1, keep
 				 * it that way & schedule work.
 				 */
-				if (__get_tb() < 
-				    (start_snooze + 
-				     naca->smt_snooze_delay*tb_ticks_per_usec)) {  
+				if (naca->smt_snooze_delay == 0 ||
+				    __get_tb() < start_snooze) {
 					HMT_low(); /* Low thread priority */
 					continue;
 				}

_