Skip to content

Commit

Permalink
arch/tile: use atomic exchange in arch_write_unlock()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chris Metcalf committed Apr 2, 2012
1 parent b14f219 commit ab306ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/tile/include/asm/spinlock_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ab306ca

Please sign in to comment.