From owner-freebsd-net@FreeBSD.ORG Tue Jul 8 14:19:46 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F607BDB; Tue, 8 Jul 2014 14:19:46 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50200281E; Tue, 8 Jul 2014 14:19:46 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 43A161FE028; Tue, 8 Jul 2014 16:19:44 +0200 (CEST) Message-ID: <53BBFE08.1080804@selasky.org> Date: Tue, 08 Jul 2014 16:19:52 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: pyunyh@gmail.com Subject: Re: [RFC] Allow m_dup() to use JUMBO clusters References: <53BA5657.8010309@selasky.org> <20140708021439.GA3965@michelle.fasterthan.com> <53BB7433.2010306@selasky.org> In-Reply-To: <53BB7433.2010306@selasky.org> Content-Type: multipart/mixed; boundary="------------060305060509090406020506" Cc: freebsd-net@freebsd.org, freebsd-current@FreeBSD.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2014 14:19:46 -0000 This is a multi-part message in MIME format. --------------060305060509090406020506 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > > Hi, > > Would it be better if my patch used the PAGE_SIZE clusters instead of > the 16K ones? Then it should not be affected by memory defragmentation. > Thanks for shedding some light into this area? > > --HPS > Hi, Updated patch attached. --HPS --------------060305060509090406020506 Content-Type: text/x-diff; name="uipc_mbuf.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="uipc_mbuf.c.diff" === sys/kern/uipc_mbuf.c ================================================================== --- sys/kern/uipc_mbuf.c (revision 268358) +++ sys/kern/uipc_mbuf.c (local) @@ -917,7 +917,15 @@ struct mbuf *n; /* Get the next new mbuf */ - if (remain >= MINCLSIZE) { + if (remain >= MJUMPAGESIZE) { + /* + * By allocating a bigger mbuf, we get fewer + * scatter gather entries for the hardware to + * process: + */ + n = m_getjcl(how, m->m_type, 0, MJUMPAGESIZE); + nsize = MJUMPAGESIZE; + } else if (remain >= MINCLSIZE) { n = m_getcl(how, m->m_type, 0); nsize = MCLBYTES; } else { --------------060305060509090406020506--