rwlock: try regular read unlock even in the hard path

Saves on turnstile trips if the lock got more readers.
This commit is contained in:
mjg 2018-01-13 00:05:31 +00:00
parent 4bda86983b
commit 6f29c630d9

View File

@ -771,9 +771,9 @@ __rw_runlock_hard(struct rwlock *rw, struct thread *td, uintptr_t v
turnstile_chain_lock(&rw->lock_object); turnstile_chain_lock(&rw->lock_object);
v = RW_READ_VALUE(rw); v = RW_READ_VALUE(rw);
retry_ts: retry_ts:
if (__predict_false(RW_READERS(v) > 1)) { if (__rw_runlock_try(rw, td, &v)) {
turnstile_chain_unlock(&rw->lock_object); turnstile_chain_unlock(&rw->lock_object);
continue; break;
} }
v &= (RW_LOCK_WAITERS | RW_LOCK_WRITE_SPINNER); v &= (RW_LOCK_WAITERS | RW_LOCK_WRITE_SPINNER);