svn commit: r244349 - projects/calloutng/sys/kern

Alexander Motin mav at FreeBSD.org
Mon Dec 17 10:23:23 UTC 2012


Author: mav
Date: Mon Dec 17 10:23:22 2012
New Revision: 244349
URL: http://svnweb.freebsd.org/changeset/base/244349

Log:
  Update cc_lastscan to now before processing events, not after. This closes
  chance of scheduling into the past if new callout scheduled while we are
  dropping the lock to execute direct callout.

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

Modified: projects/calloutng/sys/kern/kern_timeout.c
==============================================================================
--- projects/calloutng/sys/kern/kern_timeout.c	Mon Dec 17 10:12:12 2012	(r244348)
+++ projects/calloutng/sys/kern/kern_timeout.c	Mon Dec 17 10:23:22 2012	(r244349)
@@ -399,6 +399,7 @@ callout_process(struct bintime *now)
 
 	/* Compute the buckets of the last scan and present times. */
 	firstb = callout_hash(&cc->cc_lastscan);
+	cc->cc_lastscan = *now;
 	nowb = callout_hash(now);
 
 	/* Compute the last bucket and minimum time of the bucket after it. */
@@ -498,7 +499,6 @@ next:
 	if (callout_new_inserted != NULL)
 		(*callout_new_inserted)(curcpu, last, first);
 	cc->cc_firstevent = last;
-	cc->cc_lastscan = *now;
 #ifdef CALLOUT_PROFILING
 	avg_depth_dir += (depth_dir * 1000 - avg_depth_dir) >> 8;
 	avg_mpcalls_dir += (mpcalls_dir * 1000 - avg_mpcalls_dir) >> 8;


More information about the svn-src-projects mailing list