From owner-freebsd-net@FreeBSD.ORG Wed Dec 14 18:44:53 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C419216A41F for ; Wed, 14 Dec 2005 18:44:53 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (gate.funkthat.com [69.17.45.168]) by mx1.FreeBSD.org (Postfix) with ESMTP id 419C343D5E for ; Wed, 14 Dec 2005 18:44:53 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.3/8.13.3) with ESMTP id jBEIiqGv098337; Wed, 14 Dec 2005 10:44:52 -0800 (PST) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.3/8.13.3/Submit) id jBEIip8S098336; Wed, 14 Dec 2005 10:44:51 -0800 (PST) (envelope-from jmg) Date: Wed, 14 Dec 2005 10:44:51 -0800 From: John-Mark Gurney To: Ed Maste Message-ID: <20051214184451.GE55657@funkthat.com> Mail-Followup-To: Ed Maste , freebsd-net@freebsd.org References: <20051214180748.GC629@sandvine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051214180748.GC629@sandvine.com> User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 5.4-RELEASE-p6 i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html Cc: freebsd-net@freebsd.org Subject: Re: m_dup oddity -- creates mbuf chains with cluster containing 208 bytes of data X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John-Mark Gurney List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2005 18:44:53 -0000 Ed Maste wrote this message on Wed, Dec 14, 2005 at 13:07 -0500: > A colleague discovered an oddity with m_dup(9), in that duping an > mbuf with 209 or more bytes of data creates a chain with 208 bytes > of data in a cluster attached to the first mbuf, with the rest of > the data chained on the end. > > It seemed this behaviour appeared in v 1.130 of uipc_mbuf.c. The > patch below restores the behaviour of putting MCLBYTES into the > initial mbuf cluster. > > Comments? Looks correct to me... I assume you've tested this? If so, I'll commit it.. > Index: uipc_mbuf.c > =================================================================== > RCS file: /usr/cvs/src/sys/kern/uipc_mbuf.c,v > retrieving revision 1.159 > diff -u -u -3 -r1.159 uipc_mbuf.c > --- uipc_mbuf.c 8 Dec 2005 13:13:05 -0000 1.159 > +++ uipc_mbuf.c 14 Dec 2005 15:54:06 -0000 > @@ -849,7 +849,8 @@ > m_free(n); > goto nospace; > } > - nsize = MHLEN; > + if ((n->m_flags & M_EXT) == 0) > + nsize = MHLEN; > } > n->m_len = 0; -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."