summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_4bsd.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-07-28 20:39:21 +0000
committerjhb <jhb@FreeBSD.org>2008-07-28 20:39:21 +0000
commitbed722e078df53cb38b35c33a27cbe2a8c0998f5 (patch)
treed585c314fd166b901b98941569f69b36db06290a /sys/kern/sched_4bsd.c
parentc8ae327077d0d3c8aa97800e6353b1a9f93508fa (diff)
downloadFreeBSD-src-bed722e078df53cb38b35c33a27cbe2a8c0998f5.zip
FreeBSD-src-bed722e078df53cb38b35c33a27cbe2a8c0998f5.tar.gz
When choosing a CPU for a thread in a cpuset, prefer the last CPU that the
thread ran on if there are no other CPUs in the set with a shorter per-CPU runqueue.
Diffstat (limited to 'sys/kern/sched_4bsd.c')
-rw-r--r--sys/kern/sched_4bsd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 333db66..88a5494 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -1167,7 +1167,10 @@ sched_pickcpu(struct thread *td)
mtx_assert(&sched_lock, MA_OWNED);
- best = NOCPU;
+ if (THREAD_CAN_SCHED(td, td->td_lastcpu))
+ best = td->td_lastcpu;
+ else
+ best = NOCPU;
for (cpu = 0; cpu <= mp_maxid; cpu++) {
if (CPU_ABSENT(cpu))
continue;
OpenPOWER on IntegriCloud