From owner-svn-src-all@FreeBSD.ORG Sat Sep 12 21:44:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B217D1065679; Sat, 12 Sep 2009 21:44:34 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D4138FC0A; Sat, 12 Sep 2009 21:44:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CLiY2f098197; Sat, 12 Sep 2009 21:44:34 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CLiYTj098195; Sat, 12 Sep 2009 21:44:34 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200909122144.n8CLiYTj098195@svn.freebsd.org> From: Luigi Rizzo Date: Sat, 12 Sep 2009 21:44:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197137 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2009 21:44:34 -0000 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.