diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2019-11-04 18:06:04 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2019-11-04 18:06:04 +0000 |
commit | 91b75b87c81edfd1d04898931ccd1ed027126e85 (patch) | |
tree | 2c77baa45c103ce08b3b1533028ffe43a2c73a56 /sys/kern/kern_exit.c | |
parent | 5282c85f476a49e01c6106ed94884473dd50e3d6 (diff) |
Restore the old way of dispatching dead procs through idle proc.
The new way needs more thought.
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r-- | sys/kern/kern_exit.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 570aa737f2f..4c6f30cbdf8 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.179 2019/11/02 05:31:20 visa Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.180 2019/11/04 18:06:02 visa Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -367,27 +367,21 @@ struct mutex deadproc_mutex = struct proclist deadproc = LIST_HEAD_INITIALIZER(deadproc); /* - * Move dead procs from the CPU's local list to the reaper list and - * wake up the reaper. + * We are called from cpu_exit() once it is safe to schedule the + * dead process's resources to be freed. * - * This is called once it is safe to free the resources of dead processes. + * NOTE: One must be careful with locking in this routine. It's + * called from a critical section in machine-dependent code, so + * we should refrain from changing any interrupt state. + * + * We lock the deadproc list, place the proc on that list (using + * the p_hash member), and wake up the reaper. */ void -dispatch_deadproc(void) +exit2(struct proc *p) { - struct proc *dead; - struct schedstate_percpu *spc = &curcpu()->ci_schedstate; - - if (LIST_EMPTY(&spc->spc_deadproc)) - return; - - KERNEL_ASSERT_UNLOCKED(); - mtx_enter(&deadproc_mutex); - while ((dead = LIST_FIRST(&spc->spc_deadproc)) != NULL) { - LIST_REMOVE(dead, p_hash); - LIST_INSERT_HEAD(&deadproc, dead, p_hash); - } + LIST_INSERT_HEAD(&deadproc, p, p_hash); mtx_leave(&deadproc_mutex); wakeup(&deadproc); |