From eddb4efacd4901c7de5cb1f3c8bc59023ecbfe49 Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Sat, 6 Jan 2007 12:33:43 +0000 Subject: [PATCH] - Don't let SCHED_TICK_TOTAL() return less than hz. This can cause integer divide faults in roundup() later if it is able to return 0. For some reason this bug only shows up on my laptop and not my testboxes. --- sys/kern/sched_ule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 355cb9ba8ad..b96338aeaf7 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -110,7 +110,7 @@ static struct td_sched td_sched0; #define SCHED_TICK_MAX (SCHED_TICK_TARG + hz) #define SCHED_TICK_SHIFT 10 #define SCHED_TICK_HZ(ts) ((ts)->ts_ticks >> SCHED_TICK_SHIFT) -#define SCHED_TICK_TOTAL(ts) ((ts)->ts_ltick - (ts)->ts_ftick) +#define SCHED_TICK_TOTAL(ts) (max((ts)->ts_ltick - (ts)->ts_ftick, hz)) /* * These macros determine priorities for non-interactive threads. They are