m_get2() name

Gleb Smirnoff glebius at FreeBSD.org
Fri Feb 1 13:15:57 UTC 2013


On Fri, Feb 01, 2013 at 02:04:38PM +0100, Andre Oppermann wrote:
A> >    The m_get2() function allocates a single mbuf with enough space
A> > to hold specified amount of data. It can return either a single mbuf,
A> > an mbuf with a standard cluster, page size cluster, or jumbo cluster.
A> 
A> While m_get2() is a good function, I'm not too happy with it returning
A> jumbo clusters.  The size of jumbo cluster is not well specified and
A> can be anything above 2K, from 4K to 16K or more.  The network stack
A> hacker can't rely on any particular size above PAGE_SIZE to be present.
A> 
A> So I recommend to make PAGE_SIZE the largest cluster size to be available
A> in a single mbuf allocator.  PAGE_SIZE is a known quantity and plays well
A> with the allocator.  Anything larger than PAGE_SIZE causes contig_malloc
A> to be used as the requirement is physically contiguous pages for those
A> clusters.  After some uptime this may become more difficult to allocate
A> and can lead to premature allocation failures while still plenty of
A> memory would be around.  The allocation overhead for such jumbo zones
A> is higher in UMA than for PAGE_SIZE clusters.

I am against API that forbids allocating jumbo clusters. The kernel has them,
albeit their disadvantages. And API should offer them to drivers and modules.
If some module doesn't want to get a jumbo clustered mbuf from m_get2(), then
it should not request above PAGE_SIZE from m_get2() and that's all.


-- 
Totus tuus, Glebius.


More information about the freebsd-net mailing list