Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Aug 2013 13:34:37 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254781 - head/sys/netpfil/ipfw
Message-ID:  <201308241334.r7ODYbnT015525@svn.freebsd.org>

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



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