diff options
author | jhb <jhb@FreeBSD.org> | 2008-07-28 20:39:21 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-07-28 20:39:21 +0000 |
commit | bed722e078df53cb38b35c33a27cbe2a8c0998f5 (patch) | |
tree | d585c314fd166b901b98941569f69b36db06290a /sys/kern/sched_4bsd.c | |
parent | c8ae327077d0d3c8aa97800e6353b1a9f93508fa (diff) | |
download | FreeBSD-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.c | 5 |
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; |