aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2003-02-25 03:37:48 +0000
committerJeff Roberson <jeff@FreeBSD.org>2003-02-25 03:37:48 +0000
commit17661e5ac4fc6ac0e3c01fb1cfc22a79c9060a81 (patch)
treedf5eb5e550ba49b92f45eadaca861cb18128ad5d /sys/kern/kern_lock.c
parent07159f9c56de91cb7d7bd6b6a795eebfee78133e (diff)
downloadsrc-17661e5ac4fc6ac0e3c01fb1cfc22a79c9060a81.tar.gz
src-17661e5ac4fc6ac0e3c01fb1cfc22a79c9060a81.zip
- Add an interlock argument to BUF_LOCK and BUF_TIMELOCK.
- Remove the buftimelock mutex and acquire the buf's interlock to protect these fields instead. - Hold the vnode interlock while locking bufs on the clean/dirty queues. This reduces some cases from one BUF_LOCK with a LK_NOWAIT and another BUF_LOCK with a LK_TIMEFAIL to a single lock. Reviewed by: arch, mckusick
Notes
Notes: svn path=/head/; revision=111463
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index aaf09aa89622..6ee1c5c4f4a2 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -232,19 +232,16 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
else
thr = td;
- if ((flags & (LK_NOWAIT|LK_RELEASE)) == 0) {
- if ((flags & LK_INTERLOCK) == 0)
- WITNESS_SLEEP(1, NULL);
- else
- WITNESS_SLEEP(1, &interlkp->mtx_object);
- }
-
- mtx_lock(lkp->lk_interlock);
+ if ((flags & LK_INTERNAL) == 0)
+ mtx_lock(lkp->lk_interlock);
if (flags & LK_INTERLOCK) {
mtx_assert(interlkp, MA_OWNED | MA_NOTRECURSED);
mtx_unlock(interlkp);
}
+ if ((flags & (LK_NOWAIT|LK_RELEASE)) == 0)
+ WITNESS_SLEEP(1, &lkp->lk_interlock->mtx_object);
+
if (panicstr != NULL) {
mtx_unlock(lkp->lk_interlock);
return (0);