Re: panic: syncache: mbuf too small

From: Drew Gallatin <gallatin_at_netflix.com>
Date: Thu, 10 Feb 2022 18:33:20 UTC
On Thu, Feb 10, 2022 at 12:59 PM Bjoern A. Zeeb <
bzeeb-lists@lists.zabbadoz.net> wrote:

> On Wed, 9 Feb 2022, Drew Gallatin wrote:
>
> > Good point.  It looks like TCP already does this for tcp_output():
> >
> > #ifdef INET6
> >                if (MHLEN < hdrlen + max_linkhdr)
> >                        m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
> >                else
> > #endif
> >                        m = m_gethdr(M_NOWAIT, MT_DATA);
> >
>
> A few comments:
>
> (a) there's no reason anymore (especially after the bwn/bwi numbers I
> saw) that the above is limited to IPv6 so that #ifdef should go; and
> without looking at the code I'd hope there'd be a follow-up length
> check.
>
>
I agree, and I doubt people have noticed because the vast majority don't
compile out IPv6.  I personally hate all these options; it makes reading
and testing code a PITA since there are essentially 4 different cases to
consider in every part of the network stack.  If we're so concerned about
the size, it would be better to stub IPv4 and IPv6 functions into noop
inlines than have ifdefs everywhere.

<...>

(e) So even if we are good for now, looking through mbuf.h made me
> "cry" the other day.  It's very well engineered but the simplicity it
> once had is long gone; but that remains a story for another day (maybe
> the 2nd half of this year).
>

What, exactly, made you sad?

What we have now is carefully optimized for hot-path performance and to
keep all hot-path memory accesses within the first 2 cache lines.   Part of
what increased the complexity was the addition of M_EXTPG, and I'm sorry
for that, but wow does it help performance.  At least we're still quite a
bit simpler than skbuffs :)

If you plan any changes, I'd really appreciate it if you could include me
(and glebius@) in the early design phases.

Drew