Subject: Re: mbuf pros and cons [was Re: mtod abuse?]
To: tech-net@NetBSD.org, mouss <firstname.lastname@example.org>
From: Pavel Cahyna <email@example.com>
Date: 08/10/2004 09:03:38
> I had a thought about optimizing mbufs. Allow each mbuf chain only one
> 2k or 4k buffer, whichever buffer is big enough to fit every packet.
> All mbufs in the chain point their m_data into this buffer. Remove all
If there is only one buffer, why would a chain be ever needed? One mbuf
should be enough, no?
> chain cleverness for prepending/concatenating/trimming mbufs: just
> memmove or memcpy into the buffer. For every MGET/MGETHDR caller, keep
> an "exemplar" mbuf chain. Whenever an mbuf operation demands a memmove,
> rearrange the exemplar chain so that the memmove can be avoided next time.
If you start putting the data to the mbuf at the end of the buffer instead
of at the beginning, you never need to call memmove while prepending headers.
At this point, we would have exactly skbufs.