From 602dd12fbccb137326e1fe68ee555a1e572328d1 Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 30 Mar 2007 18:08:55 +0000 Subject: - 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(-) (limited to 'sys/kern/kern_rwlock.c') diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index f61da35..3180a8b 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) -- cgit v1.1