svn commit: r326533 - stable/11/sys/kern
Mark Johnston
markj at FreeBSD.org
Mon Dec 4 15:22:08 UTC 2017
Author: markj
Date: Mon Dec 4 15:22:06 2017
New Revision: 326533
URL: https://svnweb.freebsd.org/changeset/base/326533
Log:
MFC r326175, r326176:
Lockstat fixes for sx locks.
Modified:
stable/11/sys/kern/kern_sx.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/kern/kern_sx.c
==============================================================================
--- stable/11/sys/kern/kern_sx.c Mon Dec 4 15:20:39 2017 (r326532)
+++ stable/11/sys/kern/kern_sx.c Mon Dec 4 15:22:06 2017 (r326533)
@@ -456,10 +456,8 @@ sx_downgrade_(struct sx *sx, const char *file, int lin
x = sx->sx_lock;
if (!(x & SX_LOCK_SHARED_WAITERS) &&
atomic_cmpset_rel_ptr(&sx->sx_lock, x, SX_SHARERS_LOCK(1) |
- (x & SX_LOCK_EXCLUSIVE_WAITERS))) {
- LOCK_LOG_LOCK("XDOWNGRADE", &sx->lock_object, 0, 0, file, line);
- return;
- }
+ (x & SX_LOCK_EXCLUSIVE_WAITERS)))
+ goto out;
/*
* Lock the sleep queue so we can read the waiters bits
@@ -480,11 +478,12 @@ sx_downgrade_(struct sx *sx, const char *file, int lin
0, SQ_SHARED_QUEUE);
sleepq_release(&sx->lock_object);
- LOCK_LOG_LOCK("XDOWNGRADE", &sx->lock_object, 0, 0, file, line);
- LOCKSTAT_RECORD0(sx__downgrade, sx);
-
if (wakeup_swapper)
kick_proc0();
+
+out:
+ LOCK_LOG_LOCK("XDOWNGRADE", &sx->lock_object, 0, 0, file, line);
+ LOCKSTAT_RECORD0(sx__downgrade, sx);
}
/*
@@ -1108,8 +1107,6 @@ _sx_sunlock_hard(struct sx *sx, uintptr_t x, const cha
if (SCHEDULER_STOPPED())
return;
- LOCKSTAT_PROFILE_RELEASE_RWLOCK(sx__release, sx, LOCKSTAT_READER);
-
for (;;) {
if (_sx_sunlock_try(sx, &x))
break;
@@ -1145,6 +1142,7 @@ _sx_sunlock_hard(struct sx *sx, uintptr_t x, const cha
kick_proc0();
break;
}
+ LOCKSTAT_PROFILE_RELEASE_RWLOCK(sx__release, sx, LOCKSTAT_READER);
}
void
More information about the svn-src-all
mailing list