git: c2c34ee5401d - main - mbuf: add m_get_raw and m_gethdr_raw

Mateusz Guzik mjg at FreeBSD.org
Wed Jul 7 11:08:15 UTC 2021


The branch main has been updated by mjg:

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

commit c2c34ee5401d8772165707e2c80beddf8a7d60df
Author:     Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-07-06 18:51:20 +0000
Commit:     Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-07-07 11:05:46 +0000

    mbuf: add m_get_raw and m_gethdr_raw
    
    The intent is to eliminate the MT_NOINIT flag and consequently a branch
    from the constructor.
    
    Reviewed by:    gallatin
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D31080
---
 sys/kern/uipc_mbuf.c | 10 ++++++++++
 sys/sys/mbuf.h       | 28 ++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index b9e716b411be..74c8ef62eb8d 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -62,11 +62,21 @@ SDT_PROBE_DEFINE5_XLATE(sdt, , , m__init,
     "uint32_t", "uint32_t",
     "uint32_t", "uint32_t");
 
+SDT_PROBE_DEFINE3_XLATE(sdt, , , m__gethdr_raw,
+    "uint32_t", "uint32_t",
+    "uint16_t", "uint16_t",
+    "struct mbuf *", "mbufinfo_t *");
+
 SDT_PROBE_DEFINE3_XLATE(sdt, , , m__gethdr,
     "uint32_t", "uint32_t",
     "uint16_t", "uint16_t",
     "struct mbuf *", "mbufinfo_t *");
 
+SDT_PROBE_DEFINE3_XLATE(sdt, , , m__get_raw,
+    "uint32_t", "uint32_t",
+    "uint16_t", "uint16_t",
+    "struct mbuf *", "mbufinfo_t *");
+
 SDT_PROBE_DEFINE3_XLATE(sdt, , , m__get,
     "uint32_t", "uint32_t",
     "uint16_t", "uint16_t",
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 1dac5fcf32b7..2936966f6acc 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -62,7 +62,9 @@
 	SDT_PROBE5(sdt, , , probe, arg0, arg1, arg2, arg3, arg4)
 
 SDT_PROBE_DECLARE(sdt, , , m__init);
+SDT_PROBE_DECLARE(sdt, , , m__gethdr_raw);
 SDT_PROBE_DECLARE(sdt, , , m__gethdr);
+SDT_PROBE_DECLARE(sdt, , , m__get_raw);
 SDT_PROBE_DECLARE(sdt, , , m__get);
 SDT_PROBE_DECLARE(sdt, , , m__getcl);
 SDT_PROBE_DECLARE(sdt, , , m__getjcl);
@@ -956,6 +958,19 @@ m_init(struct mbuf *m, int how, short type, int flags)
 	return (error);
 }
 
+static __inline struct mbuf *
+m_get_raw(int how, short type)
+{
+	struct mbuf *m;
+	struct mb_args args;
+
+	args.flags = 0;
+	args.type = type | MT_NOINIT;
+	m = uma_zalloc_arg(zone_mbuf, &args, how);
+	MBUF_PROBE3(m__get_raw, how, type, m);
+	return (m);
+}
+
 static __inline struct mbuf *
 m_get(int how, short type)
 {
@@ -969,6 +984,19 @@ m_get(int how, short type)
 	return (m);
 }
 
+static __inline struct mbuf *
+m_gethdr_raw(int how, short type)
+{
+	struct mbuf *m;
+	struct mb_args args;
+
+	args.flags = M_PKTHDR;
+	args.type = type | MT_NOINIT;
+	m = uma_zalloc_arg(zone_mbuf, &args, how);
+	MBUF_PROBE3(m__gethdr_raw, how, type, m);
+	return (m);
+}
+
 static __inline struct mbuf *
 m_gethdr(int how, short type)
 {


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