From b80ad3eea149032f173e9de9fd7b08dd3b210c52 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 30 Mar 2007 18:08:55 +0000 Subject: [PATCH] - Drop memory barriers in rw_try_upgrade(). We don't need an 'acq' memory barrier here as the earlier rw_rlock() already contained one. - Comment fix. --- sys/kern/kern_rwlock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index f61da3586584..3180a8b36370 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -481,7 +481,7 @@ _rw_wlock_hard(struct rwlock *rw, uintptr_t tid, const char *file, int line) * value RW_UNLOCKED | RW_LOCK_WRITE_WAITERS. If we see * that value, try to acquire it once. Note that we have * to preserve the RW_LOCK_WRITE_WAITERS flag as there are - * other writers waiting still. If we fail, restart the + * other writers waiting still. If we fail, restart the * loop. */ if (v == (RW_UNLOCKED | RW_LOCK_WRITE_WAITERS)) { @@ -668,8 +668,8 @@ _rw_try_upgrade(struct rwlock *rw, const char *file, int line) */ tid = (uintptr_t)curthread; if (!(rw->rw_lock & RW_LOCK_WRITE_WAITERS)) { - success = atomic_cmpset_acq_ptr(&rw->rw_lock, - RW_READERS_LOCK(1), tid); + success = atomic_cmpset_ptr(&rw->rw_lock, RW_READERS_LOCK(1), + tid); goto out; } @@ -689,7 +689,7 @@ _rw_try_upgrade(struct rwlock *rw, const char *file, int line) * spinning. */ v = rw->rw_lock & RW_LOCK_WRITE_WAITERS; - success = atomic_cmpset_acq_ptr(&rw->rw_lock, RW_READERS_LOCK(1) | v, + success = atomic_cmpset_ptr(&rw->rw_lock, RW_READERS_LOCK(1) | v, tid | v); #ifdef ADAPTIVE_RWLOCKS if (success && v && turnstile_lookup(&rw->lock_object) != NULL)