git: 428624130abf - main - Fix lockstat:::thread-spin dtrace probe with LOCK_PROFILING

Eric van Gyzen vangyzen at FreeBSD.org
Mon Aug 2 19:45:45 UTC 2021


The branch main has been updated by vangyzen:

URL: https://cgit.FreeBSD.org/src/commit/?id=428624130abfc225b479a09a3060d0939569b1ea

commit 428624130abfc225b479a09a3060d0939569b1ea
Author:     Eric van Gyzen <vangyzen at FreeBSD.org>
AuthorDate: 2021-08-02 18:54:57 +0000
Commit:     Eric van Gyzen <vangyzen at FreeBSD.org>
CommitDate: 2021-08-02 19:44:23 +0000

    Fix lockstat:::thread-spin dtrace probe with LOCK_PROFILING
    
    The spinning start time is missing from the calculation due to a
    misplaced #endif.  Return the #endif where it's supposed to be.
    
    Submitted by:   Alexander Alexeev <aalexeev at isilon.com>
    Reviewed by:    bdrewery, mjg
    MFC after:      1 week
    Sponsored by:   Dell EMC Isilon
    Differential Revision: https://reviews.freebsd.org/D31384
---
 sys/kern/kern_mutex.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index d9db69e2ac09..a85420e62c7a 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -895,6 +895,8 @@ thread_lock_flags_(struct thread *td, int opts, const char *file, int line)
 	doing_lockprof = 1;
 #elif defined(KDTRACE_HOOKS)
 	doing_lockprof = lockstat_enabled;
+#endif
+#ifdef KDTRACE_HOOKS
 	if (__predict_false(doing_lockprof))
 		spin_time -= lockstat_nsecs(&td->td_lock->lock_object);
 #endif


More information about the dev-commits-src-main mailing list