diff options
author | jeff <jeff@FreeBSD.org> | 2005-03-31 04:25:59 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2005-03-31 04:25:59 +0000 |
commit | 2210f285f162aca91c6d927231a010a8bdf1b679 (patch) | |
tree | e18cb093186675e5a2b1728bea1138d0ae297642 /sys/kern/kern_lock.c | |
parent | 0ee22a0cda88a2e9d90b0f89208caa64d84bf08b (diff) | |
download | FreeBSD-src-2210f285f162aca91c6d927231a010a8bdf1b679.zip FreeBSD-src-2210f285f162aca91c6d927231a010a8bdf1b679.tar.gz |
- Remove apause(). It makes no sense with our present mutex implementation
since simply unlocking a mutex does not ensure that one of the waiters
will run and acquire it. We're more likely to reacquire the mutex
before anyone else has a chance. It has also bit me three times now, as
it's not safe to drop the interlock before sleeping in many cases.
Sponsored by: Isilon Systems, Inc.
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r-- | sys/kern/kern_lock.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 550538a..cc415af 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -79,7 +79,6 @@ __FBSDID("$FreeBSD$"); static struct mtx lock_mtx; static int acquire(struct lock **lkpp, int extflags, int wanted); -static int apause(struct lock *lkp, int flags); static int acquiredrain(struct lock *lkp, int extflags) ; static void @@ -113,32 +112,6 @@ shareunlock(struct thread *td, struct lock *lkp, int decr) { } } -/* - * This is the waitloop optimization. - */ -static int -apause(struct lock *lkp, int flags) -{ -#ifdef SMP - int i, lock_wait; -#endif - - if ((lkp->lk_flags & flags) == 0) - return 0; -#ifdef SMP - for (lock_wait = LOCK_WAIT_TIME; lock_wait > 0; lock_wait--) { - mtx_unlock(lkp->lk_interlock); - for (i = LOCK_SAMPLE_WAIT; i > 0; i--) - if ((lkp->lk_flags & flags) == 0) - break; - mtx_lock(lkp->lk_interlock); - if ((lkp->lk_flags & flags) == 0) - return 0; - } -#endif - return 1; -} - static int acquire(struct lock **lkpp, int extflags, int wanted) { @@ -152,12 +125,6 @@ acquire(struct lock **lkpp, int extflags, int wanted) return EBUSY; } - if ((extflags & LK_INTERLOCK) == 0) { - error = apause(lkp, wanted); - if (error == 0) - return 0; - } - s = splhigh(); while ((lkp->lk_flags & wanted) != 0) { lkp->lk_flags |= LK_WAIT_NONZERO; @@ -496,13 +463,6 @@ acquiredrain(struct lock *lkp, int extflags) { if ((extflags & LK_NOWAIT) && (lkp->lk_flags & LK_ALL)) { return EBUSY; } - - if ((extflags & LK_INTERLOCK) == 0) { - error = apause(lkp, LK_ALL); - if (error == 0) - return 0; - } - while (lkp->lk_flags & LK_ALL) { lkp->lk_flags |= LK_WAITDRAIN; error = msleep(&lkp->lk_flags, lkp->lk_interlock, lkp->lk_prio, |