From: Chris Metcalf Date: Fri, 30 Mar 2012 19:46:29 +0000 (-0400) Subject: arch/tile: use atomic exchange in arch_write_unlock() X-Git-Tag: v3.4-rc2~7^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab306cae660e524edbeb8889e4e23d3c97717b9c;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git arch/tile: use atomic exchange in arch_write_unlock() 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 --- diff --git a/arch/tile/include/asm/spinlock_64.h b/arch/tile/include/asm/spinlock_64.h index 72be590..5f8b6a0 100644 --- a/arch/tile/include/asm/spinlock_64.h +++ b/arch/tile/include/asm/spinlock_64.h @@ -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)