summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_ule.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-01-14 17:06:54 +0000
committerjhb <jhb@FreeBSD.org>2011-01-14 17:06:54 +0000
commitb92da6d9e230dcfd668f375fdb6ea6d66d69a1da (patch)
treeec8cec98b0e1b31de4d001513ee1a1ead145528f /sys/kern/sched_ule.c
parenta8f14f7c92063bb4b5e271afb698921204865fbc (diff)
downloadFreeBSD-src-b92da6d9e230dcfd668f375fdb6ea6d66d69a1da.zip
FreeBSD-src-b92da6d9e230dcfd668f375fdb6ea6d66d69a1da.tar.gz
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
Diffstat (limited to 'sys/kern/sched_ule.c')
-rw-r--r--sys/kern/sched_ule.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 8fa5f85..c1bb98f 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -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)
OpenPOWER on IntegriCloud