Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Jul 2014 16:19:52 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        pyunyh@gmail.com
Cc:        freebsd-net@freebsd.org, freebsd-current@FreeBSD.org
Subject:   Re: [RFC] Allow m_dup() to use JUMBO clusters
Message-ID:  <53BBFE08.1080804@selasky.org>
In-Reply-To: <53BB7433.2010306@selasky.org>
References:  <53BA5657.8010309@selasky.org> <20140708021439.GA3965@michelle.fasterthan.com> <53BB7433.2010306@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53BBFE08.1080804>