Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Sep 2009 21:44:34 +0000 (UTC)
From:      Luigi Rizzo <luigi@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r197137 - head/sys/kern
Message-ID:  <200909122144.n8CLiYTj098195@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: luigi
Date: Sat Sep 12 21:44:34 2009
New Revision: 197137
URL: http://svn.freebsd.org/changeset/base/197137

Log:
  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

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==============================================================================
--- head/sys/kern/kern_timeout.c	Sat Sep 12 20:37:44 2009	(r197136)
+++ head/sys/kern/kern_timeout.c	Sat Sep 12 21:44:34 2009	(r197137)
@@ -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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909122144.n8CLiYTj098195>