diff options
| author | 2009-04-14 09:13:25 +0000 | |
|---|---|---|
| committer | 2009-04-14 09:13:25 +0000 | |
| commit | 7c565ebf78938a96637b5aeb05c4218a5b9efb62 (patch) | |
| tree | 3edc5814648e6a2915cc2475db50e2c8f15cbd29 /sys/kern/sched_bsd.c | |
| parent | tweak OPTIONS; also there is no need to given an example of every "set" (diff) | |
| download | wireguard-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/sched_bsd.c')
| -rw-r--r-- | sys/kern/sched_bsd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c index 53c0902dc49..2c4e7c6caa0 100644 --- a/sys/kern/sched_bsd.c +++ b/sys/kern/sched_bsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sched_bsd.c,v 1.20 2009/03/23 13:25:11 art Exp $ */ +/* $OpenBSD: sched_bsd.c,v 1.21 2009/04/14 09:13:25 art Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /*- @@ -337,6 +337,7 @@ preempt(struct proc *newp) SCHED_LOCK(s); p->p_priority = p->p_usrpri; p->p_stat = SRUN; + p->p_cpu = sched_choosecpu(p); setrunqueue(p); p->p_stats->p_ru.ru_nivcsw++; mi_switch(); @@ -516,6 +517,7 @@ setrunnable(struct proc *p) break; } p->p_stat = SRUN; + p->p_cpu = sched_choosecpu(p); setrunqueue(p); if (p->p_slptime > 1) updatepri(p); |
