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 * [EMAIL PROTECTED] * [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message