rwlock: use fcmpset for setting RW_LOCK_WRITE_SPINNER

This commit is contained in:
Mateusz Guzik 2017-11-11 09:34:11 +00:00
parent 7a9e3b169f
commit c7e4e92ecd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325706

View File

@ -929,9 +929,8 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v, uintptr_t tid,
if ((v & RW_LOCK_READ) && RW_READERS(v) &&
spintries < rowner_retries) {
if (!(v & RW_LOCK_WRITE_SPINNER)) {
if (!atomic_cmpset_ptr(&rw->rw_lock, v,
if (!atomic_fcmpset_ptr(&rw->rw_lock, &v,
v | RW_LOCK_WRITE_SPINNER)) {
v = RW_READ_VALUE(rw);
continue;
}
}