git: 05462babd424 - main - mbuf: add m_free_raw to be used instead of directly calling uma_zfree

Mateusz Guzik mjg at FreeBSD.org
Fri Jul 2 08:30:28 UTC 2021


The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=05462babd424124762375dca186802d7355af566

commit 05462babd424124762375dca186802d7355af566
Author:     Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-06-30 14:15:25 +0000
Commit:     Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-07-02 08:30:22 +0000

    mbuf: add m_free_raw to be used instead of directly calling uma_zfree
    
    The intent is to remove all direct zone_mbuf consumers so that ctor/dtor
    from that zone can be reimplemented as wrappers around uma, avoiding an
    indirect function call.
    
    Reviewed by:    kbowling
    Discussed with: gallatin
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D30959
---
 sys/kern/kern_mbuf.c | 10 ++++++++++
 sys/sys/mbuf.h       |  1 +
 2 files changed, 11 insertions(+)

diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c
index f814d3cab6e8..2333bf887354 100644
--- a/sys/kern/kern_mbuf.c
+++ b/sys/kern/kern_mbuf.c
@@ -1526,6 +1526,16 @@ m_freem(struct mbuf *mb)
 		mb = m_free(mb);
 }
 
+/*
+ * Temporary primitive to allow freeing without going through m_free.
+ */
+void
+m_free_raw(struct mbuf *mb)
+{
+
+	uma_zfree(zone_mbuf, mb);
+}
+
 int
 m_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params,
     struct m_snd_tag **mstp)
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index ffc574817249..1dac5fcf32b7 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -825,6 +825,7 @@ void		 m_extadd(struct mbuf *, char *, u_int, m_ext_free_t,
 u_int		 m_fixhdr(struct mbuf *);
 struct mbuf	*m_fragment(struct mbuf *, int, int);
 void		 m_freem(struct mbuf *);
+void		 m_free_raw(struct mbuf *);
 struct mbuf	*m_get2(int, int, short, int);
 struct mbuf	*m_getjcl(int, short, int, int);
 struct mbuf	*m_getm2(struct mbuf *, int, int, short, int);


More information about the dev-commits-src-all mailing list