]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
arch/tile: use atomic exchange in arch_write_unlock()
authorChris Metcalf <cmetcalf@tilera.com>
Fri, 30 Mar 2012 19:46:29 +0000 (15:46 -0400)
committerChris Metcalf <cmetcalf@tilera.com>
Mon, 2 Apr 2012 16:13:49 +0000 (12:13 -0400)
This idiom is used elsewhere when we do an unlock by writing a zero,
but I missed it here.  Using an atomic operation avoids waiting
on the write buffer for the unlocking write to be sent to the home cache.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
arch/tile/include/asm/spinlock_64.h

index 72be5904e020e7df9b4923edb92bf25fbf8670a5..5f8b6a095fd84a0748ea645c96a4b3908ba6d6fb 100644 (file)
@@ -137,7 +137,7 @@ static inline void arch_read_unlock(arch_rwlock_t *rw)
 static inline void arch_write_unlock(arch_rwlock_t *rw)
 {
        __insn_mf();
-       rw->lock = 0;
+       __insn_exch4(&rw->lock, 0);  /* Avoid waiting in the write buffer. */
 }
 
 static inline int arch_read_trylock(arch_rwlock_t *rw)