summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorart <art@openbsd.org>2007-10-10 15:53:51 +0000
committerart <art@openbsd.org>2007-10-10 15:53:51 +0000
commit45053f4a9c0ff11fe529cfbf9c98901ff89d8e2c (patch)
tree8892d5c7c720788fc3d9d2cba5ce3ebc1d11f09c /sys/kern/kern_exit.c
parentsend_packet() now takes a struct in6_addr as destination instead of a (diff)
downloadwireguard-openbsd-45053f4a9c0ff11fe529cfbf9c98901ff89d8e2c.tar.xz
wireguard-openbsd-45053f4a9c0ff11fe529cfbf9c98901ff89d8e2c.zip
Make context switching much more MI:
- Move the functionality of choosing a process from cpu_switch into a much simpler function: cpu_switchto. Instead of having the locore code walk the run queues, let the MI code choose the process we want to run and only implement the context switching itself in MD code. - Let MD context switching run without worrying about spls or locks. - Instead of having the idle loop implemented with special contexts in MD code, implement one idle proc for each cpu. make the idle loop MI with MD hooks. - Change the proc lists from the old style vax queues to TAILQs. - Change the sleep queue from vax queues to TAILQs. This makes wakeup() go from O(n^2) to O(n) there will be some MD fallout, but it will be fixed shortly. There's also a few cleanups to be done after this. deraadt@, kettenis@ ok
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 4c85dd84543..fa68a37f72a 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.71 2007/04/12 22:14:15 tedu Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.72 2007/10/10 15:53:53 art Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -315,16 +315,8 @@ exit1(struct proc *p, int rv, int flags)
sigactsfree(p);
/*
- * Clear curproc after we've done all operations
- * that could block, and before tearing down the rest
- * of the process state that might be used from clock, etc.
- * Also, can't clear curproc while we're still runnable,
- * as we're not on a run queue (we are current, just not
- * a proper proc any longer!).
- *
- * Other substructures are freed from wait().
+ * Other substructures are freed from reaper and wait().
*/
- curproc = NULL;
/*
* If emulation has process exit hook, call it now.
@@ -373,15 +365,11 @@ struct proclist deadproc = LIST_HEAD_INITIALIZER(deadproc);
void
exit2(struct proc *p)
{
- int s;
-
mtx_enter(&deadproc_mutex);
LIST_INSERT_HEAD(&deadproc, p, p_hash);
mtx_leave(&deadproc_mutex);
wakeup(&deadproc);
-
- SCHED_LOCK(s);
}
/*
@@ -396,6 +384,8 @@ reaper(void)
KERNEL_PROC_UNLOCK(curproc);
+ SCHED_ASSERT_UNLOCKED();
+
for (;;) {
mtx_enter(&deadproc_mutex);
p = LIST_FIRST(&deadproc);