diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2015-05-12 09:30:36 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2015-05-12 09:30:36 +0000 |
commit | aa383bf173cd620c3b3166394ef3779d455b518f (patch) | |
tree | c480b21d7b21e281b4a8be1729965f5ae7f5cfce | |
parent | 9ee04eecbacf8db3c9fff94fece827c870e24bff (diff) |
Drop and reacquire the kernel lock in the vfs_shutdown and "cold"
portions of msleep and tsleep to give interrupts a chance to run
on other CPUs.
Tweak and OK kettenis
-rw-r--r-- | sys/kern/kern_synch.c | 20 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 15 |
2 files changed, 33 insertions, 2 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index e438f0dac99..7a49c354ae5 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.120 2015/05/07 18:30:27 mikeb Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.121 2015/05/12 09:30:35 mikeb Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -104,6 +104,9 @@ tsleep(const volatile void *ident, int priority, const char *wmesg, int timo) { struct sleep_state sls; int error, error1; +#ifdef MULTIPROCESSOR + int hold_count; +#endif KASSERT((priority & ~(PRIMASK | PCATCH)) == 0); @@ -121,6 +124,12 @@ tsleep(const volatile void *ident, int priority, const char *wmesg, int timo) */ s = splhigh(); splx(safepri); +#ifdef MULTIPROCESSOR + if (__mp_lock_held(&kernel_lock)) { + hold_count = __mp_release_all(&kernel_lock); + __mp_acquire_count(&kernel_lock, hold_count); + } +#endif splx(s); return (0); } @@ -150,6 +159,9 @@ msleep(const volatile void *ident, struct mutex *mtx, int priority, { struct sleep_state sls; int error, error1, spl; +#ifdef MULTIPROCESSOR + int hold_count; +#endif KASSERT((priority & ~(PRIMASK | PCATCH | PNORELOCK)) == 0); KASSERT(mtx != NULL); @@ -164,6 +176,12 @@ msleep(const volatile void *ident, struct mutex *mtx, int priority, spl = MUTEX_OLDIPL(mtx); MUTEX_OLDIPL(mtx) = safepri; mtx_leave(mtx); +#ifdef MULTIPROCESSOR + if (__mp_lock_held(&kernel_lock)) { + hold_count = __mp_release_all(&kernel_lock); + __mp_acquire_count(&kernel_lock, hold_count); + } +#endif if ((priority & PNORELOCK) == 0) { mtx_enter(mtx); MUTEX_OLDIPL(mtx) = spl; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 1d02681e8a2..2c1da15cba6 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.230 2015/03/14 03:38:51 jsg Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.231 2015/05/12 09:30:35 mikeb Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -1614,6 +1614,9 @@ vfs_syncwait(int verbose) struct buf *bp; int iter, nbusy, dcount, s; struct proc *p; +#ifdef MULTIPROCESSOR + int hold_count; +#endif p = curproc? curproc : &proc0; sys_sync(p, (void *)0, (register_t *)0); @@ -1648,7 +1651,17 @@ vfs_syncwait(int verbose) break; if (verbose) printf("%d ", nbusy); +#ifdef MULTIPROCESSOR + if (__mp_lock_held(&kernel_lock)) + hold_count = __mp_release_all(&kernel_lock); + else + hold_count = 0; +#endif DELAY(40000 * iter); +#ifdef MULTIPROCESSOR + if (hold_count) + __mp_acquire_count(&kernel_lock, hold_count); +#endif } return nbusy; |