aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_lock.c
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2010-06-17 10:15:13 +0000
committerAndriy Gapon <avg@FreeBSD.org>2010-06-17 10:15:13 +0000
commite7154e7ef11459fc2c3010705aa834c9efc30b02 (patch)
treeebc558d2717a297807438195c8fd3741b57ccf58 /sys/kern/subr_lock.c
parent2e983ace8fab80f4e01e73859357e5e709aea437 (diff)
downloadsrc-e7154e7ef11459fc2c3010705aa834c9efc30b02.tar.gz
src-e7154e7ef11459fc2c3010705aa834c9efc30b02.zip
Notes
Diffstat (limited to 'sys/kern/subr_lock.c')
-rw-r--r--sys/kern/subr_lock.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c
index bc43c9c0b85c..e09638e10bba 100644
--- a/sys/kern/subr_lock.c
+++ b/sys/kern/subr_lock.c
@@ -598,7 +598,7 @@ lock_profile_release_lock(struct lock_object *lo)
struct lock_profile_object *l;
struct lock_prof_type *type;
struct lock_prof *lp;
- u_int64_t holdtime;
+ u_int64_t curtime, holdtime;
struct lpohead *head;
int spin;
@@ -626,9 +626,11 @@ lock_profile_release_lock(struct lock_object *lo)
lp = lock_profile_lookup(lo, spin, l->lpo_file, l->lpo_line);
if (lp == NULL)
goto release;
- holdtime = nanoseconds() - l->lpo_acqtime;
- if (holdtime < 0)
+ curtime = nanoseconds();
+ if (curtime < l->lpo_acqtime)
goto release;
+ holdtime = curtime - l->lpo_acqtime;
+
/*
* Record if the lock has been held longer now than ever
* before.