- Allow static_boost to specify no boost with '0', traditional kernel

fixed pri boost with '1' or any priority less than the current thread's
   priority with a value greater than two.  Default the boost to
   PRI_MIN_TIMESHARE to prevent regular user-space threads from starving
   threads in the kernel.  This prevents these user-threads from also
   being scheduled as if they are high fixed-priority kernel threads.
 - Restore the setting of lowpri in tdq_choose().  It has to be either here
   or in sched_switch().  I accidentally removed it from both places.

Tested by:	kris
This commit is contained in:
Jeff Roberson 2008-04-04 01:16:18 +00:00
parent 03d17db7d5
commit 0502fe2e43

View File

@ -182,7 +182,7 @@ static int preempt_thresh = PRI_MIN_KERN;
#else
static int preempt_thresh = 0;
#endif
static int static_boost = 1;
static int static_boost = PRI_MIN_TIMESHARE;
/*
* tdq - per processor runqs and statistics. All fields are protected by the
@ -1833,8 +1833,10 @@ sched_sleep(struct thread *td, int prio)
td->td_slptick = ticks;
if (TD_IS_SUSPENDED(td) || prio <= PSOCK)
td->td_flags |= TDF_CANSWAP;
if (static_boost && prio)
if (static_boost == 1 && prio)
sched_prio(td, prio);
else if (static_boost && td->td_priority > static_boost)
sched_prio(td, static_boost);
}
/*
@ -2138,8 +2140,10 @@ sched_choose(void)
if (td) {
td->td_sched->ts_ltick = ticks;
tdq_runq_rem(tdq, td);
tdq->tdq_lowpri = td->td_priority;
return (td);
}
tdq->tdq_lowpri = PRI_MAX_IDLE;
return (PCPU_GET(idlethread));
}