Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Dec 2011 16:17:17 +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: r228960 - head/sys/kern
Message-ID:  <201112291617.pBTGHHQs063161@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Dec 29 16:17:16 2011
New Revision: 228960
URL: http://svn.freebsd.org/changeset/base/228960

Log:
  Cap the priority calculated from the current thread's running tick count
  at SCHED_PRI_RANGE to prevent overflows in the priority value.  This can
  happen due to irregularities with clock interrupts under certain
  virtualization environments.
  
  Tested by:	Larry Rosenman  ler lerctr org
  MFC after:	2 weeks

Modified:
  head/sys/kern/sched_ule.c

Modified: head/sys/kern/sched_ule.c
==============================================================================
--- head/sys/kern/sched_ule.c	Thu Dec 29 15:59:14 2011	(r228959)
+++ head/sys/kern/sched_ule.c	Thu Dec 29 16:17:16 2011	(r228960)
@@ -1434,7 +1434,8 @@ sched_priority(struct thread *td)
 	} else {
 		pri = SCHED_PRI_MIN;
 		if (td->td_sched->ts_ticks)
-			pri += SCHED_PRI_TICKS(td->td_sched);
+			pri += min(SCHED_PRI_TICKS(td->td_sched),
+			    SCHED_PRI_RANGE);
 		pri += SCHED_PRI_NICE(td->td_proc->p_nice);
 		KASSERT(pri >= PRI_MIN_BATCH && pri <= PRI_MAX_BATCH,
 		    ("sched_priority: invalid priority %d: nice %d, " 



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