From owner-freebsd-net Tue Oct 23 11:32: 2 2001 Delivered-To: freebsd-net@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id 81BA637B403 for ; Tue, 23 Oct 2001 11:31:59 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1192) id 7167A81D01; Tue, 23 Oct 2001 13:31:59 -0500 (CDT) Date: Tue, 23 Oct 2001 13:31:59 -0500 From: Alfred Perlstein To: Luigi Rizzo Cc: net@freebsd.org Subject: Re: performance issues with M_PREPEND on clusters Message-ID: <20011023133159.J15052@elvis.mu.org> References: <20011023110307.A34494@iguana.aciri.org> <20011023132813.I15052@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011023132813.I15052@elvis.mu.org>; from bright@mu.org on Tue, Oct 23, 2001 at 01:28:13PM -0500 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org * Alfred Perlstein [011023 13:28] wrote: > * Luigi Rizzo [011023 13:06] wrote: > > > > Hi, > > don't know what is the right forum to discuss this, but this is > > certainly one. I have also Bcc-ed some people who might need to be > > involved. > > > > In the mbuf code, M_LEADINGSPACE always returns 0 when M_EXT is > > set, instead of calling the second part of M_WRITABLE to check > > whether there is a chance of writing into the cluster. This means > > that both M_PREPEND() and m_pullup() will have to allocate a second > > mbuf when they are invoked on a cluster, which these days is > > basically true for most of the incoming traffic (several network > > drivers pass up the full packet in a cluster). > > I've seen this brought up before, this is not what you want to > do otherwise you risk corrupting EXT data. The right thing to > do is have the people allocating writable EXT bufs mark them > as such. Other EXT type buffers such as sendfile bufs can not > be written to no matter what the sharecount is. > > I hope this helps. Oh yeah, using this method you could "fix" MCLGET in -stable to from this: #define MCLGET(m, how) do { \ struct mbuf *_mm = (m); \ \ MCLALLOC(_mm->m_ext.ext_buf, (how)); \ if (_mm->m_ext.ext_buf != NULL) { \ _mm->m_data = _mm->m_ext.ext_buf; \ _mm->m_flags |= M_EXT; \ _mm->m_ext.ext_free = NULL; \ _mm->m_ext.ext_ref = NULL; \ _mm->m_ext.ext_size = MCLBYTES; \ } \ } while (0) to: #define MCLGET(m, how) do { \ struct mbuf *_mm = (m); \ \ MCLALLOC(_mm->m_ext.ext_buf, (how)); \ if (_mm->m_ext.ext_buf != NULL) { \ _mm->m_data = _mm->m_ext.ext_buf; \ _mm->m_flags |= M_EXT | M_EXTWRITEABLE; \ _mm->m_ext.ext_free = NULL; \ _mm->m_ext.ext_ref = NULL; \ _mm->m_ext.ext_size = MCLBYTES; \ } \ } while (0) -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' http://www.morons.org/rants/gpl-harmful.php3 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message