diff options
author | jeff <jeff@FreeBSD.org> | 2008-01-15 09:03:09 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2008-01-15 09:03:09 +0000 |
commit | 7a1cea460a6aa1f4af7bc991df6ecc77da860387 (patch) | |
tree | 0cada86322bda662ed9c0289f917629488de92c1 | |
parent | 90f3f8edb2bda24c666a8a36141ac4c371a0f58a (diff) | |
download | FreeBSD-src-7a1cea460a6aa1f4af7bc991df6ecc77da860387.zip FreeBSD-src-7a1cea460a6aa1f4af7bc991df6ecc77da860387.tar.gz |
- When executing the 'tryself' branch in sched_pickcpu() look at the
lowest priority on the queue for the current cpu vs curthread's
priority. In the case that curthread is waking up many threads of a
lower priority as would happen with a turnstile_broadcast() or wakeup()
of many threads this prevents them from all ending up on the current cpu.
- In sched_add() make the relationship between a scheduled ithread and
the current cpu advisory rather than strict. Only give the ithread
affinity for the current cpu if it's actually being scheduled from
a hardware interrupt. This prevents it from migrating when it simply
blocks on a lock.
Sponsored by: Nokia
-rw-r--r-- | sys/kern/sched_ule.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 074e85b..9957a25 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1113,7 +1113,7 @@ sched_pickcpu(struct td_sched *ts, int flags) * This may improve locality among sleepers and wakers when there * is shared data. */ - if (tryself && pri < curthread->td_priority) { + if (tryself && pri < TDQ_CPU(self)->tdq_lowpri) { CTR1(KTR_ULE, "tryself %d", curthread->td_priority); return (self); @@ -2410,9 +2410,10 @@ sched_add(struct thread *td, int flags) * Pick the destination cpu and if it isn't ours transfer to the * target cpu. */ - if (td->td_priority <= PRI_MAX_ITHD && THREAD_CAN_MIGRATE(td)) - cpu = cpuid; - else if (!THREAD_CAN_MIGRATE(td)) + if (td->td_priority <= PRI_MAX_ITHD && THREAD_CAN_MIGRATE(td) && + curthread->td_intr_nesting_level) + ts->ts_cpu = cpuid; + if (!THREAD_CAN_MIGRATE(td)) cpu = ts->ts_cpu; else cpu = sched_pickcpu(ts, flags); |