aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-09-08 18:08:32 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-09-08 18:08:32 -0400
commitec1858ca1d34e4213f886b3007f0d294fa01b867 (patch)
treefaa8fb72f54d0b8c00cc7363893cb82348f3a986
parentac0b75f5a73015913424c94ece9ac192fd61c80d (diff)
this version is more efficient in the case of heavy-contention
-rw-r--r--include/asm-sparc64/spinlock.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h
index abbf12b4d0..16931d4cd9 100644
--- a/include/asm-sparc64/spinlock.h
+++ b/include/asm-sparc64/spinlock.h
@@ -31,13 +31,18 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
31" add %0, 1, %1 \n" 31" add %0, 1, %1 \n"
32" cas [%2], %0, %1 \n" 32" cas [%2], %0, %1 \n"
33" cmp %0, %1 \n" 33" cmp %0, %1 \n"
34" bne,a,pn %%icc, 1b \n" 34" be,a,pt %%icc, 2f \n"
35" nop \n"
36" membar #LoadLoad | #StoreLoad | #LoadStore\n"
37" ba 1b\n"
35" nop \n" 38" nop \n"
36"2: lduw [%3], %1 \n" 39"2: lduw [%3], %1 \n"
37" cmp %0, %1 \n" 40" cmp %0, %1 \n"
38" bne,a,pn %%icc, 2b \n" 41" be,a,pt %%icc, 3f \n"
39" nop \n" 42" nop \n"
40" membar #StoreStore | #StoreLoad" 43" membar #LoadLoad | #StoreLoad | #LoadStore\n"
44" ba 2b\n"
45"3: membar #StoreStore | #StoreLoad"
41 : "=&r" (ticket), "=&r" (tmp) 46 : "=&r" (ticket), "=&r" (tmp)
42 : "r" (&lock->tail), "r" (&lock->head) 47 : "r" (&lock->tail), "r" (&lock->head)
43 : "memory"); 48 : "memory");
@@ -80,7 +85,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
80/* We don't handle this yet, but it looks like not re-enabling the interrupts 85/* We don't handle this yet, but it looks like not re-enabling the interrupts
81 * works fine, too. For example, lockdep also does it like this. 86 * works fine, too. For example, lockdep also does it like this.
82 */ 87 */
83#define __raw_spin_lock_flages(l, f) __raw_spin_lock(l) 88#define __raw_spin_lock_flags(l, f) __raw_spin_lock(l)
84 89
85 90
86 91