svn commit: r217237 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Mon Jan 10 20:48:11 UTC 2011


Author: jhb
Date: Mon Jan 10 20:48:10 2011
New Revision: 217237
URL: http://svn.freebsd.org/changeset/base/217237

Log:
  Fix two harmless off-by-one errors.
  
  Reviewed by:	jeff
  MFC after:	2 weeks

Modified:
  head/sys/kern/sched_ule.c

Modified: head/sys/kern/sched_ule.c
==============================================================================
--- head/sys/kern/sched_ule.c	Mon Jan 10 20:26:36 2011	(r217236)
+++ head/sys/kern/sched_ule.c	Mon Jan 10 20:48:10 2011	(r217237)
@@ -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));


More information about the svn-src-head mailing list