svn commit: r321744 - head/sys/kern

Mark Johnston markj at FreeBSD.org
Mon Jul 31 00:59:29 UTC 2017


Author: markj
Date: Mon Jul 31 00:59:28 2017
New Revision: 321744
URL: https://svnweb.freebsd.org/changeset/base/321744

Log:
  Correct the predicates on which lockstat:::{thread,spin}-spin fire.
  
  In particular, they should fire only if the lock was owned by another
  thread when we first attempted to acquire that lock.
  
  MFC after:	1 week

Modified:
  head/sys/kern/kern_mutex.c

Modified: head/sys/kern/kern_mutex.c
==============================================================================
--- head/sys/kern/kern_mutex.c	Mon Jul 31 00:54:50 2017	(r321743)
+++ head/sys/kern/kern_mutex.c	Mon Jul 31 00:59:28 2017	(r321744)
@@ -766,7 +766,7 @@ _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t
 	LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, m,
 	    contested, waittime, file, line);
 #ifdef KDTRACE_HOOKS
-	if (spin_time != 0)
+	if (lda.spin_cnt != 0)
 		LOCKSTAT_RECORD1(spin__spin, m, spin_time);
 #endif
 }
@@ -879,7 +879,7 @@ retry:
 		LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, m,
 		    contested, waittime, file, line);
 #ifdef KDTRACE_HOOKS
-	if (spin_time != 0)
+	if (lda.spin_cnt != 0)
 		LOCKSTAT_RECORD1(thread__spin, m, spin_time);
 #endif
 }


More information about the svn-src-all mailing list