Date: Thu, 2 Jan 2003 16:00:28 -0500 From: Bosko Milekic <bmilekic@unixdaemons.com> To: Andrew Gallatin <gallatin@cs.duke.edu> Cc: current@freebsd.org Subject: Re: mbuf header bloat ? Message-ID: <20030102160028.A25488@unixdaemons.com> In-Reply-To: <15892.42354.150878.922603@grasshopper.cs.duke.edu>; from gallatin@cs.duke.edu on Thu, Jan 02, 2003 at 03:47:46PM -0500 References: <Pine.BSF.4.21.0211232306410.28833-100000@InterJet.elischer.org> <15841.17237.826666.653505@grasshopper.cs.duke.edu> <20021125130005.A75177@unixdaemons.com> <15842.27547.385354.151541@grasshopper.cs.duke.edu> <20021125160122.A75673@unixdaemons.com> <15842.51914.871010.137070@grasshopper.cs.duke.edu> <20021126191526.B78371@unixdaemons.com> <15892.35521.181516.714686@grasshopper.cs.duke.edu> <20030102152930.A25321@unixdaemons.com> <15892.42354.150878.922603@grasshopper.cs.duke.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 02, 2003 at 03:47:46PM -0500, Andrew Gallatin wrote: > > To be honest, I don't really like the idea but I don't see a better > > solution. Right now, ref counting for regular mbuf clusters works > > fine and is pretty damn fast, but I don't know how I could make it > > happen for other external buffer types other than the way I just > > described. > > There's a second can of worms too. We don't want the mbuf system > freeing externally maintained refcnt pointers. So we need a type > or flag to distinguish them. > > I've appended a minimal impact patch that I came up with. It just > adds a new type (EXT_EXTREF) and leaves the m_extadd() api/abi pretty > much unchanged. Callers that want to manage their own refcnt memory > call m_extadd() like this: > > mp->m_ext.ref_cnt = &entry->ref_count; > MEXTADD(mp, (void *)entry->jbuf->buf, GM_JLEN, > gm_freebsd_ether_jfree, (void *)entry->jbuf, > 0, EXT_EXTREF); > > > It seems to work just fine, and together with some patches from Alan > Cox for kmem_malloc(), allows me to make my network driver MPSAFE. > I'm still testing for other hidden Giant acquisitions or > GIANT_REQUIRED() assertions in rare codepaths, but its been up for 15 > minutes now, and that's 14m 59sec longer than usual ;) > > Would you be OK with this or something like it? > > Thanks, > > Drew [patch snipped] Yeah, this looks like the least-intrusive way to do it. I'm okay with the patch. I like the idea of using an EXT-type flag to mark the data buffer types using this method. Thanks. P.S.: Try not to use MEXTADD, if possible. Use m_extadd() instead, which is the procedure-equivalent version. MEXTADD is just provided for 'backwards-compatibility'. It used to be a large ugly macro. -- Bosko Milekic * bmilekic@unixdaemons.com * bmilekic@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030102160028.A25488>