summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorart <art@openbsd.org>2009-04-14 09:13:25 +0000
committerart <art@openbsd.org>2009-04-14 09:13:25 +0000
commit7c565ebf78938a96637b5aeb05c4218a5b9efb62 (patch)
tree3edc5814648e6a2915cc2475db50e2c8f15cbd29 /sys/kern/kern_fork.c
parenttweak OPTIONS; also there is no need to given an example of every "set" (diff)
downloadwireguard-openbsd-7c565ebf78938a96637b5aeb05c4218a5b9efb62.tar.xz
wireguard-openbsd-7c565ebf78938a96637b5aeb05c4218a5b9efb62.zip
Some tweaks to the cpu affinity code.
- Split up choosing of cpu between fork and "normal" cases. Fork is very different and should be treated as such. - Instead of implicitly choosing a cpu in setrunqueue, do it outside where it actually makes sense. - Just because a cpu is marked as idle doesn't mean it will be soon. There could be a thundering herd effect if we call wakeup from an interrupt handler, so subtract cpus with queued processes when deciding which cpu is actually idle. - some simplifications allowed by the above. kettenis@ ok (except one bugfix that was not in the intial diff)
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 10dd9a5f8eb..b2947bd4421 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.102 2009/03/23 13:25:11 art Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.103 2009/04/14 09:13:25 art Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -432,6 +432,7 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
getmicrotime(&p2->p_stats->p_start);
p2->p_acflag = AFORK;
p2->p_stat = SRUN;
+ p2->p_cpu = sched_choosecpu_fork(p1, flags);
setrunqueue(p2);
SCHED_UNLOCK(s);