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.
This commit is contained in:
Alexander Motin 2013-08-24 13:34:36 +00:00
parent 894734cbd6
commit 5f4fc3dbcb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254781

View File

@ -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);