diff options
author | 2000-06-05 11:02:48 +0000 | |
---|---|---|
committer | 2000-06-05 11:02:48 +0000 | |
commit | f69f8c5290df53e8a3d62b3430621995269d7588 (patch) | |
tree | 8d38b62565a43a00307544c3dddf85337bbb6e96 /sys/kern/kern_proc.c | |
parent | fix datasheet url (diff) | |
download | wireguard-openbsd-f69f8c5290df53e8a3d62b3430621995269d7588.tar.xz wireguard-openbsd-f69f8c5290df53e8a3d62b3430621995269d7588.zip |
Changes to exit handling.
cpu_exit no longer frees the vmspace and u-area. This is now handled by a
separate kernel thread "reaper". This is to avoid sleeping locks in the
critical path of cpu_exit where we're not allowed to sleep.
From NetBSD
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r-- | sys/kern/kern_proc.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index d431cc3315b..b8bfac34f4d 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_proc.c,v 1.6 1999/04/28 09:28:14 art Exp $ */ +/* $OpenBSD: kern_proc.c,v 1.7 2000/06/05 11:02:50 art Exp $ */ /* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */ /* @@ -75,6 +75,16 @@ u_long pgrphash; struct proclist allproc; struct proclist zombproc; +/* + * Locking of this proclist is special; it's accessed in a + * critical section of process exit, and thus locking it can't + * modify interrupt state. We use a simple spin lock for this + * proclist. Processes on this proclist are also on zombproc; + * we use the p_hash member to linkup to deadproc. + */ +struct simplelock deadproc_slock; +struct proclist deadproc; /* dead, but not yet undead */ + static void orphanpg __P((struct pgrp *)); #ifdef DEBUG void pgrpdump __P((void)); @@ -89,6 +99,10 @@ procinit() LIST_INIT(&allproc); LIST_INIT(&zombproc); + + LIST_INIT(&deadproc); + simple_lock_init(&deadproc_slock); + pidhashtbl = hashinit(maxproc / 4, M_PROC, M_WAITOK, &pidhash); pgrphashtbl = hashinit(maxproc / 4, M_PROC, M_WAITOK, &pgrphash); uihashtbl = hashinit(maxproc / 16, M_PROC, M_WAITOK, &uihash); @@ -325,7 +339,7 @@ fixjobc(p, pgrp, entering) for (p = p->p_children.lh_first; p != 0; p = p->p_sibling.le_next) if ((hispgrp = p->p_pgrp) != pgrp && hispgrp->pg_session == mysession && - p->p_stat != SZOMB) { + P_ZOMBIE(p) == 0) { if (entering) hispgrp->pg_jobc++; else if (--hispgrp->pg_jobc == 0) |