From 0516c8dd4ab646203b0394460dac3b292cd80846 Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Sat, 30 Oct 2004 12:19:15 +0000 Subject: [PATCH] - When choosing a thread on the run queue, check to see if its nice is outside of the nice threshold due to a recently awoken thread with a lower nice value. This further reduces the amount of time a positively niced thread gets while running in conjunction with a workload that has many short sleeps (ie buildworld). --- sys/kern/sched_ule.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index fed9c2974151..a494bcdce942 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -867,8 +867,9 @@ migrate: static struct kse * kseq_choose(struct kseq *kseq) { - struct kse *ke; struct runq *swap; + struct kse *ke; + int nice; mtx_assert(&sched_lock, MA_OWNED); swap = NULL; @@ -891,7 +892,8 @@ kseq_choose(struct kseq *kseq) * TIMESHARE kse group and its nice was too far out * of the range that receives slices. */ - if (ke->ke_slice == 0) { + nice = ke->ke_proc->p_nice + (0 - kseq->ksq_nicemin); + if (ke->ke_slice == 0 || nice > SCHED_SLICE_NTHRESH) { runq_remove(ke->ke_runq, ke); sched_slice(ke); ke->ke_runq = kseq->ksq_next;