svn commit: r303584 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Sun Jul 31 12:11:56 UTC 2016


Author: mjg
Date: Sun Jul 31 12:11:55 2016
New Revision: 303584
URL: https://svnweb.freebsd.org/changeset/base/303584

Log:
  locks: change sleep_cnt and spin_cnt types to u_int
  
  Both variables are uint64_t, but they only count spins or sleeps.
  All reasonable values which we can get here comfortably hit in 32-bit range.
  
  Suggested by: kib
  MFC after:	1 week

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	Sun Jul 31 11:34:08 2016	(r303583)
+++ head/sys/kern/kern_mutex.c	Sun Jul 31 12:11:55 2016	(r303584)
@@ -409,8 +409,8 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
 	uint64_t waittime = 0;
 #endif
 #ifdef KDTRACE_HOOKS
-	uint64_t spin_cnt = 0;
-	uint64_t sleep_cnt = 0;
+	u_int spin_cnt = 0;
+	u_int sleep_cnt = 0;
 	int64_t sleep_time = 0;
 	int64_t all_time = 0;
 #endif

Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c	Sun Jul 31 11:34:08 2016	(r303583)
+++ head/sys/kern/kern_rwlock.c	Sun Jul 31 12:11:55 2016	(r303584)
@@ -357,8 +357,8 @@ __rw_rlock(volatile uintptr_t *c, const 
 	uintptr_t v;
 #ifdef KDTRACE_HOOKS
 	uintptr_t state;
-	uint64_t spin_cnt = 0;
-	uint64_t sleep_cnt = 0;
+	u_int spin_cnt = 0;
+	u_int sleep_cnt = 0;
 	int64_t sleep_time = 0;
 	int64_t all_time = 0;
 #endif
@@ -742,8 +742,8 @@ __rw_wlock_hard(volatile uintptr_t *c, u
 #endif
 #ifdef KDTRACE_HOOKS
 	uintptr_t state;
-	uint64_t spin_cnt = 0;
-	uint64_t sleep_cnt = 0;
+	u_int spin_cnt = 0;
+	u_int sleep_cnt = 0;
 	int64_t sleep_time = 0;
 	int64_t all_time = 0;
 #endif

Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c	Sun Jul 31 11:34:08 2016	(r303583)
+++ head/sys/kern/kern_sx.c	Sun Jul 31 12:11:55 2016	(r303584)
@@ -515,8 +515,8 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 	int error = 0;
 #ifdef	KDTRACE_HOOKS
 	uintptr_t state;
-	uint64_t spin_cnt = 0;
-	uint64_t sleep_cnt = 0;
+	u_int spin_cnt = 0;
+	u_int sleep_cnt = 0;
 	int64_t sleep_time = 0;
 	int64_t all_time = 0;
 #endif
@@ -820,8 +820,8 @@ _sx_slock_hard(struct sx *sx, int opts, 
 	int error = 0;
 #ifdef KDTRACE_HOOKS
 	uintptr_t state;
-	uint64_t spin_cnt = 0;
-	uint64_t sleep_cnt = 0;
+	u_int spin_cnt = 0;
+	u_int sleep_cnt = 0;
 	int64_t sleep_time = 0;
 	int64_t all_time = 0;
 #endif


More information about the svn-src-head mailing list