diff options
| author | 2019-11-04 18:06:02 +0000 | |
|---|---|---|
| committer | 2019-11-04 18:06:02 +0000 | |
| commit | 2afc0175809bf995111e1d7f5854505c04a2b2db (patch) | |
| tree | d6670666745dc89ac1dc77a40c059986df6ece37 /sys/kern/kern_exit.c | |
| parent | Regularly poll and report kubsan findings using the timeout(9) API (diff) | |
| download | wireguard-openbsd-2afc0175809bf995111e1d7f5854505c04a2b2db.tar.xz wireguard-openbsd-2afc0175809bf995111e1d7f5854505c04a2b2db.zip | |
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); |
