From owner-svn-src-projects@FreeBSD.ORG Mon Jun 11 16:35:48 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 77E361065675; Mon, 11 Jun 2012 16:35:48 +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 59D3A8FC17; Mon, 11 Jun 2012 16:35:48 +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 q5BGZmEd096390; Mon, 11 Jun 2012 16:35:48 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BGZmDS096388; Mon, 11 Jun 2012 16:35:48 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206111635.q5BGZmDS096388@svn.freebsd.org> From: Davide Italiano Date: Mon, 11 Jun 2012 16:35:48 +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: r236893 - 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 " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 16:35:48 -0000 Author: davide Date: Mon Jun 11 16:35:47 2012 New Revision: 236893 URL: http://svn.freebsd.org/changeset/base/236893 Log: The cc_firsttick field in struct callout_cpu keeps track of the time at which the nearest event in future should be fired. In case we're adding an event which time associated is greater than cc_firsttick, there's no need to call callout_new_inserted. While here, fix a style indentation bug pointed out by Bruce Evans (bde@). Modified: projects/calloutng/sys/kern/kern_timeout.c Modified: projects/calloutng/sys/kern/kern_timeout.c ============================================================================== --- projects/calloutng/sys/kern/kern_timeout.c Mon Jun 11 16:18:39 2012 (r236892) +++ projects/calloutng/sys/kern/kern_timeout.c Mon Jun 11 16:35:47 2012 (r236893) @@ -434,9 +434,9 @@ callout_tick(void) } if (next.sec == -1) next = limit; + cc->cc_firsttick = next; if (callout_new_inserted != NULL) - (*callout_new_inserted)(cpu, - next); + (*callout_new_inserted)(cpu, next); cc->cc_softticks = now; mtx_unlock_spin_flags(&cc->cc_lock, MTX_QUIET); /* @@ -496,9 +496,12 @@ callout_cc_add(struct callout *c, struct * Inform the eventtimers(4) subsystem there's a new callout * that has been inserted. */ - if (callout_new_inserted != NULL) - (*callout_new_inserted)(cpu, - to_bintime); + if (callout_new_inserted != NULL && + (bintime_cmp(&to_bintime, &cc->cc_firsttick, <) || + (cc->cc_firsttick.sec == 0 && cc->cc_firsttick.frac == 0))) { + cc->cc_firsttick = to_bintime; + (*callout_new_inserted)(cpu, to_bintime); + } } static void