diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index 370d0d6..555a9db 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -378,7 +378,8 @@ __rw_rlock(volatile uintptr_t *c, const char *file, int line) WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL); #ifdef KDTRACE_HOOKS - all_time -= lockstat_nsecs(&rw->lock_object); + if (__predict_false(lockstat_enabled)) + all_time -= lockstat_nsecs(&rw->lock_object); state = rw->rw_lock; #endif for (;;) { @@ -544,7 +545,8 @@ __rw_rlock(volatile uintptr_t *c, const char *file, int line) __func__, rw); } #ifdef KDTRACE_HOOKS - all_time += lockstat_nsecs(&rw->lock_object); + if (__predict_false(lockstat_enabled)) + all_time += lockstat_nsecs(&rw->lock_object); if (sleep_time) LOCKSTAT_RECORD4(rw__block, rw, sleep_time, LOCKSTAT_READER, (state & RW_LOCK_READ) == 0,