svn commit: r228960 - head/sys/kern
John Baldwin
jhb at FreeBSD.org
Thu Dec 29 16:17:17 UTC 2011
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, "
More information about the svn-src-all
mailing list