svn commit: r230084 - stable/8/sys/kern

John Baldwin jhb at FreeBSD.org
Fri Jan 13 20:25:57 UTC 2012


Author: jhb
Date: Fri Jan 13 20:25:56 2012
New Revision: 230084
URL: http://svn.freebsd.org/changeset/base/230084

Log:
  MFC 228960:
  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.

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	Fri Jan 13 20:25:38 2012	(r230083)
+++ stable/8/sys/kern/sched_ule.c	Fri Jan 13 20:25:56 2012	(r230084)
@@ -1426,7 +1426,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, " 


More information about the svn-src-all mailing list