From 97cc6870f68b3bc545dfb78512cc0e771a93fd70 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sun, 19 Jul 2015 22:26:02 +0000 Subject: [PATCH] Don't increment the spin count until after the first attempt to acquire a rwlock read lock. Otherwise the lockstat:::rw-spin probe will fire spuriously. MFC after: 1 week --- sys/kern/kern_rwlock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index 2921de4ef71e..370d0d6fca4b 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -382,9 +382,6 @@ __rw_rlock(volatile uintptr_t *c, const char *file, int line) state = rw->rw_lock; #endif for (;;) { -#ifdef KDTRACE_HOOKS - spin_cnt++; -#endif /* * Handle the easy case. If no other thread has a write * lock, then try to bump up the count of read locks. Note @@ -413,6 +410,9 @@ __rw_rlock(volatile uintptr_t *c, const char *file, int line) } continue; } +#ifdef KDTRACE_HOOKS + spin_cnt++; +#endif #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif