summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2007-06-05 00:00:57 +0000
committerjeff <jeff@FreeBSD.org>2007-06-05 00:00:57 +0000
commit91d150179059555ef497f4b5b5a560fdb24e472f (patch)
tree6727b982fa0d93b8aafab313bdc797aee9e314d2 /sys/kern/kern_exit.c
parent8297f778b9d0a595a99ca58d332ab4111b636019 (diff)
downloadFreeBSD-src-91d150179059555ef497f4b5b5a560fdb24e472f.zip
FreeBSD-src-91d150179059555ef497f4b5b5a560fdb24e472f.tar.gz
Commit 14/14 of sched_lock decomposition.
- Use thread_lock() rather than sched_lock for per-thread scheduling sychronization. - Use the per-process spinlock rather than the sched_lock for per-process scheduling synchronization. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 54ac392..9cab321 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -523,12 +523,13 @@ retry:
* proc lock.
*/
wakeup(p->p_pptr);
- mtx_lock_spin(&sched_lock);
+ PROC_SLOCK(p->p_pptr);
+ sched_exit(p->p_pptr, td);
+ PROC_SUNLOCK(p->p_pptr);
+ PROC_SLOCK(p);
p->p_state = PRS_ZOMBIE;
PROC_UNLOCK(p->p_pptr);
- sched_exit(p->p_pptr, td);
-
/*
* Hopefully no one will try to deliver a signal to the process this
* late in the game.
@@ -718,12 +719,13 @@ loop:
* in thread_exit() after having dropped the process
* lock via PROC_UNLOCK() but before it has completed
* cpu_throw(). In that case, the other thread must
- * still hold sched_lock, so simply by acquiring
- * sched_lock once we will wait long enough for the
+ * still hold the proc slock, so simply by acquiring
+ * proc slock once we will wait long enough for the
* thread to exit in that case.
+ * XXX This is questionable.
*/
- mtx_lock_spin(&sched_lock);
- mtx_unlock_spin(&sched_lock);
+ PROC_SLOCK(p);
+ PROC_SUNLOCK(p);
td->td_retval[0] = p->p_pid;
if (status)
@@ -820,12 +822,12 @@ loop:
sx_xunlock(&allproc_lock);
return (0);
}
- mtx_lock_spin(&sched_lock);
+ PROC_SLOCK(p);
if ((p->p_flag & P_STOPPED_SIG) &&
(p->p_suspcount == p->p_numthreads) &&
(p->p_flag & P_WAITED) == 0 &&
(p->p_flag & P_TRACED || options & WUNTRACED)) {
- mtx_unlock_spin(&sched_lock);
+ PROC_SUNLOCK(p);
p->p_flag |= P_WAITED;
sx_xunlock(&proctree_lock);
td->td_retval[0] = p->p_pid;
@@ -839,7 +841,7 @@ loop:
return (0);
}
- mtx_unlock_spin(&sched_lock);
+ PROC_SUNLOCK(p);
if (options & WCONTINUED && (p->p_flag & P_CONTINUED)) {
sx_xunlock(&proctree_lock);
td->td_retval[0] = p->p_pid;
OpenPOWER on IntegriCloud