svn commit: r313855 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Fri Feb 17 05:39:42 UTC 2017
Author: mjg
Date: Fri Feb 17 05:39:40 2017
New Revision: 313855
URL: https://svnweb.freebsd.org/changeset/base/313855
Log:
locks: let primitives for modules unlock without always goging to the slsow path
It is only needed if the LOCK_PROFILING is enabled. It has to always check if
the lock is about to be released which requires an avoidable read if the option
is not specified..
Modified:
head/sys/kern/kern_mutex.c
head/sys/kern/kern_rwlock.c
head/sys/kern/kern_sx.c
Modified: head/sys/kern/kern_mutex.c
==============================================================================
--- head/sys/kern/kern_mutex.c Fri Feb 17 05:22:58 2017 (r313854)
+++ head/sys/kern/kern_mutex.c Fri Feb 17 05:39:40 2017 (r313855)
@@ -275,7 +275,11 @@ __mtx_unlock_flags(volatile uintptr_t *c
line);
mtx_assert(m, MA_OWNED);
+#ifdef LOCK_PROFILING
__mtx_unlock_sleep(c, opts, file, line);
+#else
+ __mtx_unlock(m, curthread, opts, file, line);
+#endif
TD_LOCKS_DEC(curthread);
}
Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c Fri Feb 17 05:22:58 2017 (r313854)
+++ head/sys/kern/kern_rwlock.c Fri Feb 17 05:39:40 2017 (r313855)
@@ -341,7 +341,11 @@ _rw_wunlock_cookie(volatile uintptr_t *c
LOCK_LOG_LOCK("WUNLOCK", &rw->lock_object, 0, rw->rw_recurse, file,
line);
+#ifdef LOCK_PROFILING
_rw_wunlock_hard(rw, (uintptr_t)curthread, file, line);
+#else
+ __rw_wunlock(rw, curthread, file, line);
+#endif
TD_LOCKS_DEC(curthread);
}
Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c Fri Feb 17 05:22:58 2017 (r313854)
+++ head/sys/kern/kern_sx.c Fri Feb 17 05:39:40 2017 (r313855)
@@ -364,7 +364,11 @@ _sx_xunlock(struct sx *sx, const char *f
WITNESS_UNLOCK(&sx->lock_object, LOP_EXCLUSIVE, file, line);
LOCK_LOG_LOCK("XUNLOCK", &sx->lock_object, 0, sx->sx_recurse, file,
line);
+#ifdef LOCK_PROFILING
_sx_xunlock_hard(sx, (uintptr_t)curthread, file, line);
+#else
+ __sx_xunlock(sx, curthread, file, line);
+#endif
TD_LOCKS_DEC(curthread);
}
More information about the svn-src-head
mailing list