summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/subr_lock.c25
-rw-r--r--sys/sys/lock_profile.h6
2 files changed, 15 insertions, 16 deletions
diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c
index 8bd443150402..dfbcb25a7e50 100644
--- a/sys/kern/subr_lock.c
+++ b/sys/kern/subr_lock.c
@@ -254,21 +254,18 @@ void _lock_profile_obtain_lock_success(struct lock_object *lo, int contested, ui
{
struct lock_profile_object *l = &lo->lo_profile_obj;
- /* don't reset the timer when/if recursing */
- if (l->lpo_acqtime == 0) {
- lo->lo_profile_obj.lpo_contest_holding = 0;
-
- if (contested)
- lo->lo_profile_obj.lpo_contest_locking++;
+ lo->lo_profile_obj.lpo_contest_holding = 0;
- l->lpo_filename = file;
- l->lpo_lineno = line;
- l->lpo_acqtime = nanoseconds();
- if (waittime && (l->lpo_acqtime > waittime))
- l->lpo_waittime = l->lpo_acqtime - waittime;
- else
- l->lpo_waittime = 0;
- }
+ if (contested)
+ lo->lo_profile_obj.lpo_contest_locking++;
+
+ l->lpo_filename = file;
+ l->lpo_lineno = line;
+ l->lpo_acqtime = nanoseconds();
+ if (waittime && (l->lpo_acqtime > waittime))
+ l->lpo_waittime = l->lpo_acqtime - waittime;
+ else
+ l->lpo_waittime = 0;
}
void _lock_profile_release_lock(struct lock_object *lo)
diff --git a/sys/sys/lock_profile.h b/sys/sys/lock_profile.h
index 91f303206635..26ee57cc6ca5 100644
--- a/sys/sys/lock_profile.h
+++ b/sys/sys/lock_profile.h
@@ -129,12 +129,14 @@ static inline void lock_profile_obtain_lock_failed(struct lock_object *lo, int *
static inline void lock_profile_obtain_lock_success(struct lock_object *lo, int contested, uint64_t waittime, const char *file, int line)
{
- if (lock_prof_enable) {
+
+ /* don't reset the timer when/if recursing */
+ if (lock_prof_enable && lo->lo_profile_obj.lpo_acqtime == 0) {
#ifdef LOCK_PROFILING_FAST
if (contested == 0)
return;
#endif
- _lock_profile_obtain_lock_success(lo, contested, waittime, file, line);
+ _lock_profile_obtain_lock_success(lo, contested, waittime, file, line);
}
}
static inline void lock_profile_release_lock(struct lock_object *lo)