Fix an off-by-one error in r228960. The maximum priority delta provided

by SCHED_PRI_TICKS should be SCHED_PRI_RANGE - 1 so that the resulting
priority value (before nice adjustment) is between SCHED_PRI_MIN and
SCHED_PRI_MAX, inclusive.

Submitted by:	kib
Reported by:	pho
MFC after:	1 week
This commit is contained in:
John Baldwin 2013-12-03 14:50:12 +00:00
parent 3ed6dfa678
commit 5457fa234b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=258869

View File

@ -1532,7 +1532,7 @@ sched_priority(struct thread *td)
pri = SCHED_PRI_MIN;
if (td->td_sched->ts_ticks)
pri += min(SCHED_PRI_TICKS(td->td_sched),
SCHED_PRI_RANGE);
SCHED_PRI_RANGE - 1);
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, "