Rework realtime priority support:
- Move the realtime priority range up above kernel sleep priorities and just below interrupt thread priorities. - Contract the interrupt and kernel sleep priority ranges a bit so that the timesharing priority band can be increased. The new timeshare range is now slightly larger than the old realtime + timeshare ranges. - Change the ULE scheduler to no longer use realtime priorities for interactive threads. Instead, the larger timeshare range is now split into separate subranges for interactive and non-interactive ("batch") threads. The end result is that interactive threads and non-interactive threads still use the same priority ranges as before, but realtime threads now have a separate, dedicated priority range. - Do not modify the priority of non-timeshare threads in sched_sleep() or via cv_broadcastpri(). Realtime and idle priority threads will no longer have their priorities affected by sleeping in the kernel. Reviewed by: jeff
This commit is contained in:
parent
640c77e126
commit
2dc29adb9f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217410
@ -908,7 +908,7 @@ sched_sleep(struct thread *td, int pri)
|
||||
THREAD_LOCK_ASSERT(td, MA_OWNED);
|
||||
td->td_slptick = ticks;
|
||||
td->td_sched->ts_slptime = 0;
|
||||
if (pri)
|
||||
if (pri != 0 && PRI_BASE(td->td_pri_class) == PRI_TIMESHARE)
|
||||
sched_prio(td, pri);
|
||||
if (TD_IS_SUSPENDED(td) || pri >= PSOCK)
|
||||
td->td_flags |= TDF_CANSWAP;
|
||||
|
@ -118,11 +118,17 @@ static struct td_sched td_sched0;
|
||||
|
||||
/*
|
||||
* Priority ranges used for interactive and non-interactive timeshare
|
||||
* threads. Interactive threads use realtime priorities.
|
||||
* threads. The timeshare priorities are split up into four ranges.
|
||||
* The first range handles interactive threads. The last three ranges
|
||||
* (NHALF, x, and NHALF) handle non-interactive threads with the outer
|
||||
* ranges supporting nice values.
|
||||
*/
|
||||
#define PRI_MIN_INTERACT PRI_MIN_REALTIME
|
||||
#define PRI_MAX_INTERACT PRI_MAX_REALTIME
|
||||
#define PRI_MIN_BATCH PRI_MIN_TIMESHARE
|
||||
#define PRI_TIMESHARE_RANGE (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE + 1)
|
||||
#define PRI_INTERACT_RANGE ((PRI_TIMESHARE_RANGE - SCHED_PRI_NRESV) / 2)
|
||||
|
||||
#define PRI_MIN_INTERACT PRI_MIN_TIMESHARE
|
||||
#define PRI_MAX_INTERACT (PRI_MIN_TIMESHARE + PRI_INTERACT_RANGE - 1)
|
||||
#define PRI_MIN_BATCH (PRI_MIN_TIMESHARE + PRI_INTERACT_RANGE)
|
||||
#define PRI_MAX_BATCH PRI_MAX_TIMESHARE
|
||||
|
||||
/*
|
||||
@ -1893,6 +1899,8 @@ sched_sleep(struct thread *td, int prio)
|
||||
td->td_slptick = ticks;
|
||||
if (TD_IS_SUSPENDED(td) || prio >= PSOCK)
|
||||
td->td_flags |= TDF_CANSWAP;
|
||||
if (PRI_BASE(td->td_pri_class) != PRI_TIMESHARE)
|
||||
return;
|
||||
if (static_boost == 1 && prio)
|
||||
sched_prio(td, prio);
|
||||
else if (static_boost && td->td_priority > static_boost)
|
||||
|
@ -745,7 +745,8 @@ sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri)
|
||||
|
||||
/* Adjust priority if requested. */
|
||||
MPASS(pri == 0 || (pri >= PRI_MIN && pri <= PRI_MAX));
|
||||
if (pri != 0 && td->td_priority > pri)
|
||||
if (pri != 0 && td->td_priority > pri &&
|
||||
PRI_BASE(td->td_pri_class) == PRI_TIMESHARE)
|
||||
sched_prio(td, pri);
|
||||
|
||||
/*
|
||||
|
@ -67,10 +67,10 @@
|
||||
* Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ)
|
||||
* are insignificant. Ranges are as follows:
|
||||
*
|
||||
* Interrupt threads: 0 - 63
|
||||
* Top half kernel threads: 64 - 127
|
||||
* Realtime user threads: 128 - 159
|
||||
* Time sharing user threads: 160 - 223
|
||||
* Interrupt threads: 0 - 47
|
||||
* Realtime user threads: 48 - 79
|
||||
* Top half kernel threads: 80 - 119
|
||||
* Time sharing user threads: 120 - 223
|
||||
* Idle user threads: 224 - 255
|
||||
*
|
||||
* XXX If/When the specific interrupt thread and top half thread ranges
|
||||
@ -81,7 +81,7 @@
|
||||
#define PRI_MAX (255) /* Lowest priority. */
|
||||
|
||||
#define PRI_MIN_ITHD (PRI_MIN)
|
||||
#define PRI_MAX_ITHD (PRI_MIN_KERN - 1)
|
||||
#define PRI_MAX_ITHD (PRI_MIN_REALTIME - 1)
|
||||
|
||||
#define PI_REALTIME (PRI_MIN_ITHD + 0)
|
||||
#define PI_AV (PRI_MIN_ITHD + 4)
|
||||
@ -92,8 +92,11 @@
|
||||
#define PI_SOFT (PRI_MIN_ITHD + 24)
|
||||
#define PI_SWI(x) (PI_SOFT + (x) * RQ_PPQ)
|
||||
|
||||
#define PRI_MIN_KERN (64)
|
||||
#define PRI_MAX_KERN (PRI_MIN_REALTIME - 1)
|
||||
#define PRI_MIN_REALTIME (48)
|
||||
#define PRI_MAX_REALTIME (PRI_MIN_KERN - 1)
|
||||
|
||||
#define PRI_MIN_KERN (80)
|
||||
#define PRI_MAX_KERN (PRI_MIN_TIMESHARE - 1)
|
||||
|
||||
#define PSWP (PRI_MIN_KERN + 0)
|
||||
#define PVM (PRI_MIN_KERN + 4)
|
||||
@ -106,10 +109,7 @@
|
||||
#define PLOCK (PRI_MIN_KERN + 32)
|
||||
#define PPAUSE (PRI_MIN_KERN + 36)
|
||||
|
||||
#define PRI_MIN_REALTIME (128)
|
||||
#define PRI_MAX_REALTIME (PRI_MIN_TIMESHARE - 1)
|
||||
|
||||
#define PRI_MIN_TIMESHARE (160)
|
||||
#define PRI_MIN_TIMESHARE (120)
|
||||
#define PRI_MAX_TIMESHARE (PRI_MIN_IDLE - 1)
|
||||
|
||||
#define PUSER (PRI_MIN_TIMESHARE)
|
||||
|
Loading…
Reference in New Issue
Block a user