summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_bsd.c
diff options
context:
space:
mode:
authorart <art@openbsd.org>2008-07-18 23:43:31 +0000
committerart <art@openbsd.org>2008-07-18 23:43:31 +0000
commit2c9d4ccbcf9b120efddf613d0ef0d6e5a35509ec (patch)
tree804a1919b1859d64d3ce0d66bf3e17b153623f2e /sys/kern/sched_bsd.c
parentno need for .Pp before or after .Sh; (diff)
downloadwireguard-openbsd-2c9d4ccbcf9b120efddf613d0ef0d6e5a35509ec.tar.xz
wireguard-openbsd-2c9d4ccbcf9b120efddf613d0ef0d6e5a35509ec.zip
Add a macro that clears the want_resched flag that need_resched sets.
Right now when mi_switch picks up the same proc, we didn't clear the flag which would mean that every time we service an AST we would attempt a context switch. For some architectures, amd64 being probably the most extreme, that meant attempting to context switch for every trap and interrupt. Now we clear_resched explicitly after every context switch, even if it didn't do anything. Which also allows us to remove some more code in cpu_switchto (not done yet). miod@ ok
Diffstat (limited to 'sys/kern/sched_bsd.c')
-rw-r--r--sys/kern/sched_bsd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index 2bfbadbec94..e7babbb88ed 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.16 2008/05/22 14:07:14 thib Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.17 2008/07/18 23:43:31 art Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -415,6 +415,8 @@ mi_switch(void)
p->p_stat = SONPROC;
}
+ clear_resched(curcpu());
+
SCHED_ASSERT_LOCKED();
/*