Hi all, On Mon, Jun 12, 2006 at 08:37:43PM +0200, Andreas Mohr wrote: > Hi all, > > while reviewing 2.6.17-rc6-mm1, I found some places that might > want to make use of cpu_relax() in order to not block secondary > pipelines while busy-polling (probably especially useful on SMT CPUs): Patch no. 2 of 3. This could be considered overkill given the previous unlikely(), but it is busy-looping on failure after all... Signed-off-by: Andreas Mohr <andi@xxxxxxxx> diff -urN linux-2.6.17-rc6-mm2.orig/include/asm-i386/acpi.h linux-2.6.17-rc6-mm2.my/include/asm-i386/acpi.h --- linux-2.6.17-rc6-mm2.orig/include/asm-i386/acpi.h 2006-06-08 10:38:10.000000000 +0200 +++ linux-2.6.17-rc6-mm2.my/include/asm-i386/acpi.h 2006-06-13 19:35:41.000000000 +0200 @@ -61,11 +61,14 @@ __acpi_acquire_global_lock (unsigned int *lock) { unsigned int old, new, val; - do { + while (1) { old = *lock; new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1)); val = cmpxchg(lock, old, new); - } while (unlikely (val != old)); + if (likely(val == old)) + break; + cpu_relax(); + } return (new < 3) ? -1 : 0; } @@ -73,11 +76,14 @@ __acpi_release_global_lock (unsigned int *lock) { unsigned int old, new, val; - do { + while (1) { old = *lock; new = old & ~0x3; val = cmpxchg(lock, old, new); - } while (unlikely (val != old)); + if (likely(val == old)) + break; + cpu_relax(); + } return old & 0x1; } - To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html