Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2012 16:35:48 +0000 (UTC)
From:      Davide Italiano <davide@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r236893 - projects/calloutng/sys/kern
Message-ID:  <201206111635.q5BGZmDS096388@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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