diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-10-05 17:43:09 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-10-05 17:43:09 +0000 |
commit | b1f0999c04e72d7ec869947978955972b2daf1c1 (patch) | |
tree | a897ed94d053ec6e6363da2c841f33f31151efa7 | |
parent | f4e7d6017ab2ebcc4255aa582a3d1743ea76a7a5 (diff) |
Don't drop the big lock at the end of exit1(), but move it into the middle of
sched_exit(). This means that cpu_exit() and whatever it does (for instance
calling free(), as well as the deadproc p_hash handling are now locked as well.
This may have been one of the causes of the reaper panics, especially with
rthread patches... which were terminating a lot of threads very quickly onto
the deadproc p_hash list.
ok kurt kettenis miod
-rw-r--r-- | sys/kern/kern_exit.c | 5 | ||||
-rw-r--r-- | sys/kern/kern_sched.c | 7 |
2 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 23c11c5283a..b8336c38499 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.85 2009/06/24 13:03:20 kurt Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.86 2009/10/05 17:43:07 deraadt Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -319,9 +319,6 @@ exit1(struct proc *p, int rv, int flags) if (p->p_emul->e_proc_exit) (*p->p_emul->e_proc_exit)(p); - /* This process no longer needs to hold the kernel lock. */ - KERNEL_PROC_UNLOCK(p); - /* * Finally, call machine-dependent code to switch to a new * context (possibly the idle context). Once we are no longer diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 08694052d08..15d57cf037c 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sched.c,v 1.13 2009/04/22 08:35:54 art Exp $ */ +/* $OpenBSD: kern_sched.c,v 1.14 2009/10/05 17:43:08 deraadt Exp $ */ /* * Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org> * @@ -180,9 +180,8 @@ sched_exit(struct proc *p) LIST_INSERT_HEAD(&spc->spc_deadproc, p, p_hash); -#ifdef MULTIPROCESSOR - KASSERT(__mp_lock_held(&kernel_lock) == 0); -#endif + /* This process no longer needs to hold the kernel lock. */ + KERNEL_PROC_UNLOCK(p); SCHED_LOCK(s); idle = spc->spc_idleproc; |