Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Mar 2007 03:54:53 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Dave Baukus <david.baukus@us.fujitsu.com>
Cc:        net@freebsd.org
Subject:   Re: netisr_direct
Message-ID:  <20070310035135.B30274@fledge.watson.org>
In-Reply-To: <45F08F1D.5080708@us.fujitsu.com>
References:  <45C0CA5D.5090903@incunabulum.net> <45E6BEE0.2050307@FreeBSD.org> <45E6C22D.7060200@freebsd.org> <45E6D70C.10104@FreeBSD.org> <45EEB086.3050409@FreeBSD.org> <45F03269.7050705@FreeBSD.org> <45F08F1D.5080708@us.fujitsu.com>

next in thread | previous in thread | raw e-mail | index | archive | help
University of Cambridge

On Thu, 8 Mar 2007, Dave Baukus wrote:

> What's the word on netisr_direct ? Do people typically enable this feature ?

Direct dispatch is the default configuration for the network stack in FreeBSD 
7.x.  Many users have reported performance improvements, especially in high 
packets-per-second receive environments.  However, some users have reported 
performance loss on some SMP systems with some workloads.  Direct dispatch 
will generally significantly lower the overhead of in-bound packet processing 
in the network stack by avoiding context switches.  It also introduces 
parallelism in the in-bound network layer processing path by allowing 
processing to occur in more than one thread at a time.  However, you can see 
reduced parallelism in some environments as the ithread no longer run 
concurrently with the netisr.  I would not use net.isr.direct in versions of 
FreeBSD before 6.1, but it should be pretty safe for 6.1 and later.

Robert N M Watson
Computer Laboratory
University of Cambridge

>
> net/netisr.c:
> static int      netisr_direct = 0;
> SYSCTL_INT(_net_isr, OID_AUTO, direct, CTLFLAG_RW,
>    &netisr_direct, 0, "enable direct dispatch");
> TUNABLE_INT("net.isr.direct", &netisr_direct);
>
>
>        /*
>         * Do direct dispatch only for MPSAFE netisrs (and
>         * only when enabled).  Note that when a netisr is
>         * marked MPSAFE we permit multiple concurrent instances
>         * to run.  We guarantee only the order in which
>         * packets are processed for each "dispatch point" in
>         * the system (i.e. call to netisr_dispatch or
>         * netisr_queue).  This insures ordering of packets
>         * from an interface but does not guarantee ordering
>         * between multiple places in the system (e.g. IP
>         * dispatched from interfaces vs. IP queued from IPSec).
>         */
>        if (netisr_direct && (ni->ni_flags & NETISR_MPSAFE)) {
>                isrstat.isrs_directed++;
>                /*
>                 * NB: We used to drain the queue before handling
>                 * the packet but now do not.  Doing so here will
>                 * not preserve ordering so instead we fallback to
>                 * guaranteeing order only from dispatch points
>                 * in the system (see above).
>                 */
>                ni->ni_handler(m);
>
> -- 
> Dave Baukus
>   david.baukus@us.fujitsu.com
>   972-479-2491
>
>   Fujitsu Network Communications
>         Richardson, Texas
>                 USA
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
>



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