From owner-freebsd-hackers Thu Oct 17 17:33:04 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id RAA12539 for hackers-outgoing; Thu, 17 Oct 1996 17:33:04 -0700 (PDT) Received: from root.com (implode.root.com [198.145.90.17]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id RAA12530; Thu, 17 Oct 1996 17:32:58 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by root.com (8.7.6/8.6.5) with SMTP id RAA13429; Thu, 17 Oct 1996 17:34:01 -0700 (PDT) Message-Id: <199610180034.RAA13429@root.com> X-Authentication-Warning: implode.root.com: Host localhost [127.0.0.1] didn't use HELO protocol To: Mark Tinguely cc: freebsd-atm@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: custom free for external mbuf In-reply-to: Your message of "Thu, 17 Oct 1996 17:23:18 CDT." <199610172223.RAA09577@plains.nodak.edu> From: David Greenman Reply-To: dg@root.com Date: Thu, 17 Oct 1996 17:34:01 -0700 Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >If I add a new flag entry (say M_PERM) and change the MFREE routine (here >I show changes to the "notyet" part of MFREE, the current MFREE changes >would be simular): > > if ((m)->m_flags & M_EXT) { \ >+ if ((m)->m_flags & M_PERM) { \ >+ if ((m)->m_ext.ext_free) \ >+ (*((m)->m_ext.ext_free))((m), \ >+ (m)->m_ext.ext_size); \ >+ } \ >+ else \ > if ((m)->m_ext.ext_free) \ > (*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \ > (m)->m_ext.ext_size); \ > else \ > MCLFREE((m)->m_ext.ext_buf); \ > } \ > (n) = (m)->m_next; \ >+ if ((m)->m_flags & M_PERM == 0) { \ > FREE((m), mbtypes[(m)->m_type]); \ > } \ > } It seems to me that the above can be optimized: if ((m)->m_flags & M_EXT) { \ if ((m)->m_ext.ext_free) {\ if ((m)->m_flags & M_PERM) \ (*((m)->m_ext.ext_free))((m), \ (m)->m_ext.ext_size); \ else \ (*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \ (m)->m_ext.ext_size); \ } else \ MCLFREE((m)->m_ext.ext_buf); \ } \ This would retain the same performance as the original routine in the standard case of no external free function. -DG David Greenman Core-team/Principal Architect, The FreeBSD Project