mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
Revert "Microoptimize locking primitives by avoiding unnecessary atomic ops."
This reverts commit 25669dd1d9562b9b1717d5ef59b15e1716c81634.
(cherry picked from commit 6b79b52cf3)
This commit is contained in:
parent
1ff5180ece
commit
ca29eed2d2
2 changed files with 3 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue