diff options
author | John Baldwin <jhb@FreeBSD.org> | 2001-04-03 01:39:23 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2001-04-03 01:39:23 +0000 |
commit | 5b3047d59f0b521393360a54036116a64bc35e38 (patch) | |
tree | 0313d9ddc0255e96d8b06e64ce9d63133f8c7080 /sys/kern/kern_sig.c | |
parent | fb45b6d4e325853edb4f822c90228f59ab09e7f7 (diff) | |
download | src-5b3047d59f0b521393360a54036116a64bc35e38.tar.gz src-5b3047d59f0b521393360a54036116a64bc35e38.zip |
Change stop() to require the sched_lock as well as p's process lock to
avoid silly lock contention on sched_lock since in 2 out of the 3 places
that we call stop(), we get sched_lock right after calling it and we were
locking sched_lock inside of stop() anyways.
Notes
Notes:
svn path=/head/; revision=75104
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r-- | sys/kern/kern_sig.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 3429f39701ae..6ed921a1cd39 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1240,7 +1240,9 @@ psignal(p, sig) psignal(p->p_pptr, SIGCHLD); PROC_UNLOCK(p->p_pptr); } + mtx_lock_spin(&sched_lock); stop(p); + mtx_unlock_spin(&sched_lock); goto out; } else goto runfast; @@ -1396,8 +1398,8 @@ issignal(p) psignal(p->p_pptr, SIGCHLD); PROC_UNLOCK(p->p_pptr); do { - stop(p); mtx_lock_spin(&sched_lock); + stop(p); PROC_UNLOCK_NOSWITCH(p); DROP_GIANT_NOSWITCH(); mi_switch(); @@ -1474,8 +1476,8 @@ issignal(p) psignal(p->p_pptr, SIGCHLD); PROC_UNLOCK(p->p_pptr); } - stop(p); mtx_lock_spin(&sched_lock); + stop(p); PROC_UNLOCK_NOSWITCH(p); DROP_GIANT_NOSWITCH(); mi_switch(); @@ -1519,19 +1521,19 @@ issignal(p) /* * Put the argument process into the stopped state and notify the parent * via wakeup. Signals are handled elsewhere. The process must not be - * on the run queue. Must be called with the proc p locked. + * on the run queue. Must be called with the proc p locked and the scheduler + * lock held. */ -void +static void stop(p) register struct proc *p; { PROC_LOCK_ASSERT(p, MA_OWNED); - mtx_lock_spin(&sched_lock); + mtx_assert(&sched_lock, MA_OWNED); p->p_stat = SSTOP; p->p_flag &= ~P_WAITED; wakeup((caddr_t)p->p_pptr); - mtx_unlock_spin(&sched_lock); } /* |