Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Oct 2013 14:55:19 -0400
From:      Zaphod Beeblebrox <zbeeble@gmail.com>
To:        Garrett Wollman <wollman@hergotha.csail.mit.edu>
Cc:        net@freebsd.org
Subject:   Re: Or it could be ZFS memory starvation and 9k packets (was Re: istgt causes massive jumbo nmbclusters loss)
Message-ID:  <CACpH0MesWGZrKaprjAyhxvGidvmGKq%2B%2BuOW2SniFnbqJ8ARTgA@mail.gmail.com>
In-Reply-To: <201310260552.r9Q5qcIv092748@hergotha.csail.mit.edu>
References:  <CACpH0MfEy50Y5QOZCdn2co_JmY_QPfVRxYwK-73W0WYsHB-Fqw@mail.gmail.com> <201310260552.r9Q5qcIv092748@hergotha.csail.mit.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
To be clear, I made just this patch:

Index: if_em.c
===================================================================
--- if_em.c     (revision 256870)
+++ if_em.c     (working copy)
@@ -1343,10 +1343,10 @@
        */
        if (adapter->hw.mac.max_frame_size <= 2048)
                adapter->rx_mbuf_sz = MCLBYTES;
-       else if (adapter->hw.mac.max_frame_size <= 4096)
+       else /*if (adapter->hw.mac.max_frame_size <= 4096) */
                adapter->rx_mbuf_sz = MJUMPAGESIZE;
-       else
-               adapter->rx_mbuf_sz = MJUM9BYTES;
+       /* else
+               adapter->rx_mbuf_sz = MJUM9BYTES; */

        /* Prepare receive descriptors and buffers */
        if (em_setup_receive_structures(adapter)) {

(which is against 9.2-STABLE if you're looking).

The result is that no 9k clusters appear to be allocated.  I'm still
running the system as before, but so far the problem has not recurred.  Of
note, given your comment, is that this patch doesn't appear to break
anything, either.  Should I send-pr it?


On Sat, Oct 26, 2013 at 1:52 AM, Garrett Wollman <
wollman@hergotha.csail.mit.edu> wrote:

> In article <
> CACpH0MfEy50Y5QOZCdn2co_JmY_QPfVRxYwK-73W0WYsHB-Fqw@mail.gmail.com> you
> write:
>
> >Now... below the netstat -m shows 1399 9k bufs with 376 available.  When
> >the network gets busy, I've seen 4k or even 5k bufs in total... never near
> >the 77k max.  After some time of lesser activity, the number of 9k buffers
> >returns to this level.
>
> The network interface (driver) almost certainly should not be using 9k
> mbufs.  These buffers are physically contiguous, and after not too
> much activity, it will be nearly impossible to allocate three
> physically contiguous buffers.
>
> >> That has an em0 with jumbo packets enabled:
> >>
> >> em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu
> 9014
>
> I don't know for certain about em(4), but it very likely should not be
> using 9k mbufs.  Intel network hardware has done scatter-gather since
> nearly the year dot.  (Seriously, I wrote a network driver for the
> i82586 back at the very beginning of FreeBSD's existence, and *that*
> part had scatter-gather.  No jumbo frames, though!)
>
> The entire existence of 9k and 16k mbufs is probably a mistake.  There
> should not be any network interfaces that are modern enough to do
> jumbo frames but ancient enough to require physically contiguous pages
> for each frame.  I don't know if the em(4) driver is written such that
> you can just disable the use of those mbufs, though.  You could try
> making this change, though.  Look for this code in if_em.c:
>
>         /*
>         ** Figure out the desired mbuf
>         ** pool for doing jumbos
>         */
>         if (adapter->max_frame_size <= 2048)
>                 adapter->rx_mbuf_sz = MCLBYTES;
>         else if (adapter->max_frame_size <= 4096)
>                 adapter->rx_mbuf_sz = MJUMPAGESIZE;
>         else
>                 adapter->rx_mbuf_sz = MJUM9BYTES;
>
> Comment out the last two lines and change the else if (...) to else.
> It's not obvious that the rest of the code can cope with this, but it
> does work that way on other Intel hardware so it seems like it may be
> worth a shot.
>
> -GAWollman
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACpH0MesWGZrKaprjAyhxvGidvmGKq%2B%2BuOW2SniFnbqJ8ARTgA>