powerpc: Remove static branch prediction in atomic{, 64}_add_unless
authorAnton Blanchard <anton@samba.org>
Mon, 3 Oct 2016 06:03:03 +0000 (17:03 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 4 Oct 2016 05:13:13 +0000 (16:13 +1100)
I see quite a lot of static branch mispredictions on a simple
web serving workload. The issue is in __atomic_add_unless(), called
from _atomic_dec_and_lock(). There is no obvious common case, so it
is better to let the hardware predict the branch.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/atomic.h

index f08d567e0ca4dfb75d560afa6b72473643f12c56..2b90335194a76b1ba39ea37c460700da1fc47a72 100644 (file)
@@ -233,7 +233,7 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
        PPC_ATOMIC_ENTRY_BARRIER
 "1:    lwarx   %0,0,%1         # __atomic_add_unless\n\
        cmpw    0,%0,%3 \n\
-       beq-    2f \n\
+       beq     2f \n\
        add     %0,%2,%0 \n"
        PPC405_ERR77(0,%2)
 "      stwcx.  %0,0,%1 \n\
@@ -539,7 +539,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
        PPC_ATOMIC_ENTRY_BARRIER
 "1:    ldarx   %0,0,%1         # __atomic_add_unless\n\
        cmpd    0,%0,%3 \n\
-       beq-    2f \n\
+       beq     2f \n\
        add     %0,%2,%0 \n"
 "      stdcx.  %0,0,%1 \n\
        bne-    1b \n"