summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_timeout.c
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2009-09-12 21:44:34 +0000
committerluigi <luigi@FreeBSD.org>2009-09-12 21:44:34 +0000
commit02e6d1c7f95b09e7d57ae3d261a65a3ea25aa637 (patch)
tree038a01fdad153f9d3018c6809f286c39a62278f2 /sys/kern/kern_timeout.c
parent9dcdfc82261fcde3c7860795b2ec84136965264a (diff)
downloadFreeBSD-src-02e6d1c7f95b09e7d57ae3d261a65a3ea25aa637.zip
FreeBSD-src-02e6d1c7f95b09e7d57ae3d261a65a3ea25aa637.tar.gz
Make sure callouts are not processed one tick late.
The problem was introduced in SVN 180608/ rev 1.114 and affects all users of callout_reset() (including select, usleep, setitimer). A better fix probably involves replicating 'ticks' in the struct callout_cpu; this commit is just a temporary thing so that we can MFC it after a suitable test time and RE approval. MFC after: 3 days
Diffstat (limited to 'sys/kern/kern_timeout.c')
-rw-r--r--sys/kern/kern_timeout.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index 7df03dc..3ce5069 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -244,7 +244,7 @@ callout_tick(void)
need_softclock = 0;
cc = CC_SELF();
mtx_lock_spin_flags(&cc->cc_lock, MTX_QUIET);
- for (; (cc->cc_softticks - ticks) < 0; 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;
@@ -323,7 +323,7 @@ softclock(void *arg)
steps = 0;
cc = (struct callout_cpu *)arg;
CC_LOCK(cc);
- while (cc->cc_softticks != ticks) {
+ while (cc->cc_softticks - 1 != ticks) {
/*
* cc_softticks may be modified by hard clock, so cache
* it while we work on a given bucket.
OpenPOWER on IntegriCloud