summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-01-10 20:48:10 +0000
committerjhb <jhb@FreeBSD.org>2011-01-10 20:48:10 +0000
commit27afded0797f0bf32128ad5a76b6c75b9c20c7a2 (patch)
tree70fa3114e98a76178a2d85104db0e8e82c14a660
parenta3d023442bf206e79556df5e18db54a551d315f7 (diff)
downloadFreeBSD-src-27afded0797f0bf32128ad5a76b6c75b9c20c7a2.zip
FreeBSD-src-27afded0797f0bf32128ad5a76b6c75b9c20c7a2.tar.gz
Fix two harmless off-by-one errors.
Reviewed by: jeff MFC after: 2 weeks
-rw-r--r--sys/kern/sched_ule.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index bee0474..0ebcc75 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -149,7 +149,7 @@ static struct td_sched td_sched0;
#define SCHED_PRI_NHALF (SCHED_PRI_NRESV / 2)
#define SCHED_PRI_MIN (PRI_MIN_TIMESHARE + SCHED_PRI_NHALF)
#define SCHED_PRI_MAX (PRI_MAX_TIMESHARE - SCHED_PRI_NHALF)
-#define SCHED_PRI_RANGE (SCHED_PRI_MAX - SCHED_PRI_MIN)
+#define SCHED_PRI_RANGE (SCHED_PRI_MAX - SCHED_PRI_MIN + 1)
#define SCHED_PRI_TICKS(ts) \
(SCHED_TICK_HZ((ts)) / \
(roundup(SCHED_TICK_TOTAL((ts)), SCHED_PRI_RANGE) / SCHED_PRI_RANGE))
@@ -1406,8 +1406,8 @@ sched_priority(struct thread *td)
score = imax(0, sched_interact_score(td) + td->td_proc->p_nice);
if (score < sched_interact) {
pri = PRI_MIN_REALTIME;
- pri += ((PRI_MAX_REALTIME - PRI_MIN_REALTIME) / sched_interact)
- * score;
+ pri += ((PRI_MAX_REALTIME - PRI_MIN_REALTIME + 1) /
+ sched_interact) * score;
KASSERT(pri >= PRI_MIN_REALTIME && pri <= PRI_MAX_REALTIME,
("sched_priority: invalid interactive priority %d score %d",
pri, score));
OpenPOWER on IntegriCloud