diff options
author | jhb <jhb@FreeBSD.org> | 2000-10-20 07:52:10 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2000-10-20 07:52:10 +0000 |
commit | be4bef87195253b0d51cb76174f828b33d066609 (patch) | |
tree | 10e0488cf8e0da60d45bfe1f12f3c041026e5154 /sys | |
parent | d24b54adc770857a36d2f8957eac8c99f18bfed1 (diff) | |
download | FreeBSD-src-be4bef87195253b0d51cb76174f828b33d066609.zip FreeBSD-src-be4bef87195253b0d51cb76174f828b33d066609.tar.gz |
- GC some #if 0'd code regarding the non-existant safepri variable.
- Don't dink with the witness state of Giant unless we actually own it
during mi_switch().
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_synch.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 3031334..b6b2609 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -44,8 +44,10 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> +#include <sys/ipl.h> #include <sys/kernel.h> #include <sys/ktr.h> +#include <sys/mutex.h> #include <sys/signalvar.h> #include <sys/resourcevar.h> #include <sys/vmmeter.h> @@ -58,9 +60,7 @@ #endif #include <machine/cpu.h> -#include <machine/ipl.h> #include <machine/smp.h> -#include <machine/mutex.h> static void sched_setup __P((void *dummy)); SYSINIT(sched_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, sched_setup, NULL) @@ -377,19 +377,6 @@ updatepri(p) static TAILQ_HEAD(slpquehead, proc) slpque[TABLESIZE]; #define LOOKUP(x) (((intptr_t)(x) >> 8) & (TABLESIZE - 1)) -#if 0 -/* - * During autoconfiguration or after a panic, a sleep will simply - * lower the priority briefly to allow interrupts, then return. - * The priority to be used (safepri) is machine-dependent, thus this - * value is initialized and maintained in the machine-dependent layers. - * This priority will typically be 0, or the lowest priority - * that is safe for use on the interrupt stack; it can be made - * higher to block network software interrupts after panics. - */ -int safepri; -#endif - void sleepinit(void) { @@ -899,7 +886,8 @@ mi_switch() p, p->p_pid, p->p_comm, (void *) sched_lock.mtx_lock); mtx_enter(&sched_lock, MTX_SPIN | MTX_RLIKELY); - WITNESS_SAVE(&Giant, Giant); + if (mtx_owned(&Giant)) + WITNESS_SAVE(&Giant, Giant); for (giantreleased = 0; mtx_owned(&Giant); giantreleased++) mtx_exit(&Giant, MTX_DEF | MTX_NOSWITCH); @@ -958,7 +946,8 @@ mi_switch() mtx_exit(&sched_lock, MTX_SPIN); while (giantreleased--) mtx_enter(&Giant, MTX_DEF); - WITNESS_RESTORE(&Giant, Giant); + if (mtx_owned(&Giant)) + WITNESS_RESTORE(&Giant, Giant); splx(x); } |