Date: Thu, 17 Oct 1996 17:34:01 -0700 From: David Greenman <dg@root.com> To: Mark Tinguely <tinguely@plains.nodak.edu> Cc: freebsd-atm@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: custom free for external mbuf Message-ID: <199610180034.RAA13429@root.com> In-Reply-To: Your message of "Thu, 17 Oct 1996 17:23:18 CDT." <199610172223.RAA09577@plains.nodak.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610180034.RAA13429>
