Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Jul 2012 11:52:53 +0000 (UTC)
From:      Davide Italiano <davide@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r237919 - in projects/calloutng/sys: conf kern
Message-ID:  <201207011152.q61BqrEq000167@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: davide
Date: Sun Jul  1 11:52:52 2012
New Revision: 237919
URL: http://svn.freebsd.org/changeset/base/237919

Log:
  - Take in account aggregation when comparing event times in
  callout_process() and when we submit events to eventtimers(4).
  
  - Fix a bug in the 'steps' variable logic in softclock(). It shouldn't be
  zeroed every time we extract a new event for processing it from cc_expireq.
  
  - Indent string should be there, I wrongly removed it.
  
  Reported by:		mav [1,2], pluknet [3]

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

Modified: projects/calloutng/sys/conf/NOTES
==============================================================================
--- projects/calloutng/sys/conf/NOTES	Sun Jul  1 09:35:15 2012	(r237918)
+++ projects/calloutng/sys/conf/NOTES	Sun Jul  1 11:52:52 2012	(r237919)
@@ -1,4 +1,4 @@
-
+# $FreeBSD$
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #

Modified: projects/calloutng/sys/kern/kern_timeout.c
==============================================================================
--- projects/calloutng/sys/kern/kern_timeout.c	Sun Jul  1 09:35:15 2012	(r237918)
+++ projects/calloutng/sys/kern/kern_timeout.c	Sun Jul  1 11:52:52 2012	(r237919)
@@ -378,7 +378,9 @@ callout_process(void)
 	for (;;) {	
 		sc = &cc->cc_callwheel[first];
 		TAILQ_FOREACH(tmp, sc, c_links.tqe) {
-			if (bintime_cmp(&tmp->c_time, &now, <=)) {
+			next = tmp->c_time;
+			bintime_sub(&next, &tmp->c_precision);
+			if (bintime_cmp(&next, &now, <=)) {
 				/* 
 				 * Consumer told us the callout may be run
 				 * directly from hardware interrupt context.
@@ -499,6 +501,7 @@ callout_cc_add(struct callout *c, struct
     struct bintime to_bintime, void (*func)(void *), void *arg, int cpu, 
     int flags)
 {
+	struct bintime bt;
 	int bucket, r_shift, r_val;	
 	
 	CC_LOCK_ASSERT(cc);
@@ -546,10 +549,12 @@ callout_cc_add(struct callout *c, struct
 	    c, c_links.tqe);
 	/*
 	 * Inform the eventtimers(4) subsystem there's a new callout 
-	 * that has been inserted.
+	 * that has been inserted, but only if really required.
 	 */
+	bt = c->c_time;
+	bintime_add(&bt, &c->c_precision); 
 	if (callout_new_inserted != NULL && 
-	    (bintime_cmp(&c->c_time, &cc->cc_firstevent, <) ||
+	    (bintime_cmp(&bt, &cc->cc_firstevent, <) ||
 	    (cc->cc_firstevent.sec == 0 && cc->cc_firstevent.frac == 0))) {
 		cc->cc_firstevent = c->c_time;
 		(*callout_new_inserted)(cpu, c->c_time);
@@ -784,7 +789,6 @@ softclock(void *arg)
 			TAILQ_REMOVE(&cc->cc_expireq, c, c_staiter);
 			c = softclock_call_cc(c, cc, &mpcalls,
 			    &lockcalls, &gcalls);
-			steps = 0;
 		}	
 	}
 #ifdef CALLOUT_PROFILING



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