Skip to contentSkip to conversation

add cpu_relax() in spin loops

PATCH New Fenghua Yu 1 participant 1 message Nov 10, 2004

lore
Share & tools
lore

Fenghua Yu

author
#0 lore raw

PATCH 1/1 add cpu_relax() in spin loops

This patch adds cpu_relax() in the body of spin loops in smp_call_function(), smp_call_function_single(), and ia64_mca_wakeup_ipi_wait().

The patch is against the latest linux-ia64-test-2.6.10 bk tree.

Thanks.

-Fenghua

arch/ia64/kernel/mca.c +1 -0
@@ -686,6 +686,7 @@ ia64_mca_wakeup_ipi_wait(void)
 			irr = ia64_getreg(_IA64_REG_CR_IRR3);
 			break;
 		}
+		cpu_relax();
 	} while (!(irr & (1UL << irr_bit))) ;
 }
 
arch/ia64/kernel/smp.c +4 -4
@@ -290,11 +290,11 @@ smp_call_function_single (int cpuid, voi
 
 	/* Wait for response */
 	while (atomic_read(&data.started) != cpus)
-		barrier();
+		cpu_relax();
 
 	if (wait)
 		while (atomic_read(&data.finished) != cpus)
-			barrier();
+			cpu_relax();
 	call_data = NULL;
 
 	spin_unlock_bh(&call_lock);
@@ -349,11 +349,11 @@ smp_call_function (void (*func) (void *i
 
 	/* Wait for response */
 	while (atomic_read(&data.started) != cpus)
-		barrier();
+		cpu_relax();
 
 	if (wait)
 		while (atomic_read(&data.finished) != cpus)
-			barrier();
+			cpu_relax();
 	call_data = NULL;
 
 	spin_unlock(&call_lock);