svn commit: r230083 - stable/9/sys/kern

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


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

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/9/sys/kern/sched_ule.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/kern/sched_ule.c
==============================================================================
--- stable/9/sys/kern/sched_ule.c	Fri Jan 13 20:23:18 2012	(r230082)
+++ stable/9/sys/kern/sched_ule.c	Fri Jan 13 20:25:38 2012	(r230083)
@@ -1429,7 +1429,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-stable-9 mailing list