svn commit: r254781 - head/sys/netpfil/ipfw

Alexander Motin mav at FreeBSD.org
Sat Aug 24 13:34:37 UTC 2013


Author: mav
Date: Sat Aug 24 13:34:36 2013
New Revision: 254781
URL: http://svnweb.freebsd.org/changeset/base/254781

Log:
  Make dummynet use new direct callout(9) execution mechanism.  Since the only
  thing done by the dummynet handler is taskqueue_enqueue() call, it doesn't
  need extra switch to the clock SWI context.
  
  On idle system this change in half reduces number of active CPU cycles and
  wakes up only one CPU from sleep instead of two.
  
  I was going to make this change much earlier as part of calloutng project,
  but waited for better solution with skipping idle ticks to be implemented.
  Unfortunately with 10.0 release coming it is better get at least this.

Modified:
  head/sys/netpfil/ipfw/ip_dummynet.c

Modified: head/sys/netpfil/ipfw/ip_dummynet.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_dummynet.c	Sat Aug 24 13:15:42 2013	(r254780)
+++ head/sys/netpfil/ipfw/ip_dummynet.c	Sat Aug 24 13:34:36 2013	(r254781)
@@ -82,13 +82,15 @@ dummynet(void *arg)
 {
 
 	(void)arg;	/* UNUSED */
-	taskqueue_enqueue(dn_tq, &dn_task);
+	taskqueue_enqueue_fast(dn_tq, &dn_task);
 }
 
 void
 dn_reschedule(void)
 {
-	callout_reset(&dn_timeout, 1, dummynet, NULL);
+
+	callout_reset_sbt(&dn_timeout, tick_sbt, 0, dummynet, NULL,
+	    C_HARDCLOCK | C_DIRECT_EXEC);
 }
 /*----- end of callout hooks -----*/
 
@@ -2159,12 +2161,12 @@ ip_dn_init(void)
 	DN_LOCK_INIT();
 
 	TASK_INIT(&dn_task, 0, dummynet_task, curvnet);
-	dn_tq = taskqueue_create("dummynet", M_WAITOK,
+	dn_tq = taskqueue_create_fast("dummynet", M_WAITOK,
 	    taskqueue_thread_enqueue, &dn_tq);
 	taskqueue_start_threads(&dn_tq, 1, PI_NET, "dummynet");
 
 	callout_init(&dn_timeout, CALLOUT_MPSAFE);
-	callout_reset(&dn_timeout, 1, dummynet, NULL);
+	dn_reschedule();
 
 	/* Initialize curr_time adjustment mechanics. */
 	getmicrouptime(&dn_cfg.prev_t);


More information about the svn-src-head mailing list