From owner-svn-src-projects@FreeBSD.ORG  Sat Jun  2 13:04:51 2012
Return-Path: <owner-svn-src-projects@FreeBSD.ORG>
Delivered-To: svn-src-projects@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8C3791065670;
	Sat,  2 Jun 2012 13:04:51 +0000 (UTC)
	(envelope-from davide@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 77AFE8FC0A;
	Sat,  2 Jun 2012 13:04:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q52D4pvZ090539;
	Sat, 2 Jun 2012 13:04:51 GMT (envelope-from davide@svn.freebsd.org)
Received: (from davide@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q52D4p2X090537;
	Sat, 2 Jun 2012 13:04:51 GMT (envelope-from davide@svn.freebsd.org)
Message-Id: <201206021304.q52D4p2X090537@svn.freebsd.org>
From: Davide Italiano <davide@FreeBSD.org>
Date: Sat, 2 Jun 2012 13:04:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
X-SVN-Group: projects
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r236449 - projects/calloutng/sys/kern
X-BeenThere: svn-src-projects@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the src &quot; projects&quot;
	tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
	<mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
	<mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 02 Jun 2012 13:04:51 -0000

Author: davide
Date: Sat Jun  2 13:04:50 2012
New Revision: 236449
URL: http://svn.freebsd.org/changeset/base/236449

Log:
  Replace binuptime() with getbinuptime() because it's suitable for the
  purpose and it's cheaper. Update the relative comment on precision error
  during callwheel scan as well.
  
  Move the exit condition for the wheel scan before the increment of the
  bucket. Before this change, it may happen that the last slot of the wheel
  is not examined.
  
  Pointed out by:		mav

Modified:
  projects/calloutng/sys/kern/kern_timeout.c

Modified: projects/calloutng/sys/kern/kern_timeout.c
==============================================================================
--- projects/calloutng/sys/kern/kern_timeout.c	Sat Jun  2 12:26:14 2012	(r236448)
+++ projects/calloutng/sys/kern/kern_timeout.c	Sat Jun  2 13:04:50 2012	(r236449)
@@ -373,9 +373,9 @@ callout_tick(void)
 	need_softclock = 0;
 	cc = CC_SELF();
 	mtx_lock_spin_flags(&cc->cc_lock, MTX_QUIET);
-	binuptime(&now);
+	getbinuptime(&now);
 	/* 
-	 * Get binuptime() may be inaccurate and return time up to 1/HZ in the past. 
+	 * getbinuptime() may be inaccurate and return time up to 1/HZ in the past. 
 	 * In order to avoid the possible loss of one or more events look back 1/HZ
 	 * in the past from the time we last checked.
 	 */	
@@ -405,9 +405,9 @@ callout_tick(void)
 				need_softclock = 1;
 			}	
 		}
-		first = (first + 1) & callwheelmask;
 		if (first == last)
 			break;
+		first = (first + 1) & callwheelmask;
 	}
 	cc->cc_softticks = now;
 	mtx_unlock_spin_flags(&cc->cc_lock, MTX_QUIET);