Revert "Microoptimize locking primitives by avoiding unnecessary atomic ops."

This reverts commit 25669dd1d9562b9b1717d5ef59b15e1716c81634.

(cherry picked from commit 6b79b52cf3)
This commit is contained in:
Franco Fichtner 2017-02-16 20:29:01 +01:00
parent 1ff5180ece
commit ca29eed2d2
2 changed files with 3 additions and 5 deletions

View file

@ -809,9 +809,7 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t tid, const char *file,
all_time -= lockstat_nsecs(&rw->lock_object);
state = rw->rw_lock;
#endif
for (;;) {
if (rw->rw_lock == RW_UNLOCKED && _rw_write_lock(rw, tid))
break;
while (!_rw_write_lock(rw, tid)) {
#ifdef KDTRACE_HOOKS
lda.spin_cnt++;
#endif

View file

@ -96,7 +96,7 @@
#define __rw_wlock(rw, tid, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
\
if ((rw)->rw_lock != RW_UNLOCKED || !_rw_write_lock((rw), _tid))\
if (!_rw_write_lock((rw), _tid)) \
_rw_wlock_hard((rw), _tid, (file), (line)); \
else \
LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(rw__acquire, rw, \
@ -112,7 +112,7 @@
else { \
LOCKSTAT_PROFILE_RELEASE_RWLOCK(rw__release, rw, \
LOCKSTAT_WRITER); \
if ((rw)->rw_lock != _tid || !_rw_write_unlock((rw), _tid))\
if (!_rw_write_unlock((rw), _tid)) \
_rw_wunlock_hard((rw), _tid, (file), (line)); \
} \
} while (0)