Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jan 2011 20:48:11 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217237 - head/sys/kern
Message-ID:  <201101102048.p0AKmB9r093018@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101102048.p0AKmB9r093018>