From b5b26198a7f928a0b1366da879539ba7818485af Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 28 Oct 2008 03:26:25 +0000 Subject: [PATCH] After a machine has been up for a bit more than 20 days with HZ=1000, "ticks" goes negative. This breaks the signed comparison in softclock. This causes sleep() to never wake up, tcp to stop, etc etc. This is bad(TM). Use the SEQ_LT() method from tcp's sequence number comparisons. --- sys/kern/kern_timeout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index fe05d2ca48ab..bd754b155e00 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -233,7 +233,7 @@ callout_tick(void) need_softclock = 0; cc = CC_SELF(); mtx_lock_spin_flags(&cc->cc_lock, MTX_QUIET); - for (; cc->cc_softticks < ticks; cc->cc_softticks++) { + for (; (cc->cc_softticks - ticks) < 0; cc->cc_softticks++) { bucket = cc->cc_softticks & callwheelmask; if (!TAILQ_EMPTY(&cc->cc_callwheel[bucket])) { need_softclock = 1;