svn commit: r217984 - stable/8/sys/kern
John Baldwin
jhb at FreeBSD.org
Thu Jan 27 21:32:50 UTC 2011
Author: jhb
Date: Thu Jan 27 21:32:50 2011
New Revision: 217984
URL: http://svn.freebsd.org/changeset/base/217984
Log:
MFC 217237,217291:
- Fix two harmless off-by-one errors.
- Always use PRI_BASE() when checking the base type of a thread's priority
class.
Modified:
stable/8/sys/kern/sched_ule.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
Modified: stable/8/sys/kern/sched_ule.c
==============================================================================
--- stable/8/sys/kern/sched_ule.c Thu Jan 27 21:27:49 2011 (r217983)
+++ stable/8/sys/kern/sched_ule.c Thu Jan 27 21:32:50 2011 (r217984)
@@ -153,7 +153,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))
@@ -1391,7 +1391,7 @@ sched_priority(struct thread *td)
int score;
int pri;
- if (td->td_pri_class != PRI_TIMESHARE)
+ if (PRI_BASE(td->td_pri_class) != PRI_TIMESHARE)
return;
/*
* If the score is interactive we place the thread in the realtime
@@ -1409,8 +1409,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));
@@ -2142,7 +2142,7 @@ sched_clock(struct thread *td)
ts = td->td_sched;
if (td->td_pri_class & PRI_FIFO_BIT)
return;
- if (td->td_pri_class == PRI_TIMESHARE) {
+ if (PRI_BASE(td->td_pri_class) == PRI_TIMESHARE) {
/*
* We used a tick; charge it to the thread so
* that we can compute our interactivity.
More information about the svn-src-stable-8
mailing list