summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2009-04-20 08:48:18 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2009-04-20 08:48:18 +0000
commit4244758b30dcad184aac3878ed35f88804bb0e64 (patch)
treef6905ae936b286b78ed283fd6f6e90426ac5e342 /sys/kern
parent11898ced181c6e19164b4e4e87fa13e5ec226d7d (diff)
Make pegging a proc work when there are idle cpus that are looking for
something to do. Walk the highest priority queue looking for a proc to steal and skip those that are pegged. We could consider walking the other queues in the future too, but this should do for now. kettenis@ guenther@ ok
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sched.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c
index 7205832b79f..f7b58cd0b43 100644
--- a/sys/kern/kern_sched.c
+++ b/sys/kern/kern_sched.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sched.c,v 1.11 2009/04/14 09:13:25 art Exp $ */
+/* $OpenBSD: kern_sched.c,v 1.12 2009/04/20 08:48:17 art Exp $ */
/*
* Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org>
*
@@ -407,19 +407,24 @@ sched_steal_proc(struct cpu_info *self)
while ((ci = cpuset_first(&set)) != NULL) {
struct proc *p;
+ int queue;
int cost;
cpuset_del(&set, ci);
spc = &ci->ci_schedstate;
- p = TAILQ_FIRST(&spc->spc_qs[ffs(spc->spc_whichqs) - 1]);
- KASSERT(p);
- cost = sched_proc_to_cpu_cost(self, p);
+ queue = ffs(spc->spc_whichqs) - 1;
+ TAILQ_FOREACH(p, &spc->spc_qs[queue], p_runq) {
+ if (p->p_flag & P_CPUPEG)
+ continue;
- if (best == NULL || cost < bestcost) {
- best = p;
- bestcost = cost;
+ cost = sched_proc_to_cpu_cost(self, p);
+
+ if (best == NULL || cost < bestcost) {
+ best = p;
+ bestcost = cost;
+ }
}
}
if (best == NULL)