Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Feb 2017 05:39:40 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313855 - head/sys/kern
Message-ID:  <201702170539.v1H5de82032123@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702170539.v1H5de82032123>