From owner-freebsd-net@FreeBSD.ORG  Fri Feb  1 13:15:57 2013
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: net@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by hub.freebsd.org (Postfix) with ESMTP id 822EE539;
 Fri,  1 Feb 2013 13:15:57 +0000 (UTC)
 (envelope-from glebius@FreeBSD.org)
Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10])
 by mx1.freebsd.org (Postfix) with ESMTP id EB75A696;
 Fri,  1 Feb 2013 13:15:56 +0000 (UTC)
Received: from cell.glebius.int.ru (localhost [127.0.0.1])
 by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r11DFtjc097754;
 Fri, 1 Feb 2013 17:15:55 +0400 (MSK)
 (envelope-from glebius@FreeBSD.org)
Received: (from glebius@localhost)
 by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r11DFtlI097753;
 Fri, 1 Feb 2013 17:15:55 +0400 (MSK)
 (envelope-from glebius@FreeBSD.org)
X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to
 glebius@FreeBSD.org using -f
Date: Fri, 1 Feb 2013 17:15:55 +0400
From: Gleb Smirnoff <glebius@FreeBSD.org>
To: Andre Oppermann <andre@freebsd.org>
Subject: Re: m_get2() name
Message-ID: <20130201131555.GJ91075@glebius.int.ru>
References: <20130201120414.GG91075@FreeBSD.org> <510BBD66.4080903@freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
In-Reply-To: <510BBD66.4080903@freebsd.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: net@FreeBSD.org
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 01 Feb 2013 13:15:57 -0000

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.