Date: Thu, 1 May 2003 13:06:38 -0400 From: Bosko Milekic <bmilekic@unixdaemons.com> To: Luigi Rizzo <rizzo@icir.org> Cc: freebsd-net@freebsd.org Subject: Re: Review needed: Mbuf double-free detection patch Message-ID: <20030501170638.GA17758@unixdaemons.com> In-Reply-To: <20030501041210.A3514@xorpc.icir.org> References: <20030430142532.F3741@odysseus.silby.com> <20030501041210.A3514@xorpc.icir.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 01, 2003 at 04:12:10AM -0700, Luigi Rizzo wrote: > as Bosko noticed, it would be a good idea to make the change to subr_mbuf.c > conditionally compiled under DIAGNOSTIC or INVARIANTS or the like. > > I was actually wondering if you have caught already any bug > with this code enabled. > > [on a side note, it is a bit depressing to see the same > code replicated twice, in m_free() and m_freem(). Couldn't > one try to make m_freem() just call m_free() in a loop and > save some code bloat ? I doubt the extra function call > would harm performance too much.] > > cheers > luigi The reason it's done that way has to do with a bigger optimization than just the avoidance of the extra function call: the cache lock is held, as most as possible, across repeated calls to mb_free(). In order to implement this "as most as possible," to allow for virtually atomic frees in some cases, it was ripped out and done that way... if you can figure out a cleaner way, that would be cool, though. -- Bosko Milekic bmilekic@unixdaemons.com bmilekic@FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030501170638.GA17758>