git: 671babc79497 - main - mbuf: make m_pullup() an inline over most expected case
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 19 Oct 2026 17:32:32 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=671babc79497587ef5a59f58578f8fce9359398c
commit 671babc79497587ef5a59f58578f8fce9359398c
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-10-19 17:31:50 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-10-19 17:31:50 +0000
mbuf: make m_pullup() an inline over most expected case
Implement a most typical use of m_pullup() as an inline and leave only the
heavy part as a function. A sweeping change to make benefit of the new
version follows.
Reviewed by: pouria, zlei, gallatin
Differential Revision: https://reviews.freebsd.org/D60688
---
sys/kern/uipc_mbuf.c | 2 +-
sys/sys/mbuf.h | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 5e9c13c55881..840110477504 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -926,7 +926,7 @@ m_adj_decap(struct mbuf *mp, int len)
* contiguous region in an attempt to avoid being called next time.
*/
struct mbuf *
-m_pullup(struct mbuf *n, int len)
+__m_pullup(struct mbuf *n, int len)
{
struct mbuf *m;
int count;
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 7651562f1392..8029369f7f7f 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -862,7 +862,7 @@ int m_pkthdr_init(struct mbuf *, int);
struct mbuf *m_prepend(struct mbuf *, int, int);
void m_print(const struct mbuf *, int);
struct mbuf *m_pulldown(struct mbuf *, int, int, int *);
-struct mbuf *m_pullup(struct mbuf *, int);
+struct mbuf *__m_pullup(struct mbuf *, int);
int m_sanity(struct mbuf *, int);
struct mbuf *m_split(struct mbuf *, int, int);
struct mbuf *m_uiotombuf(struct uio *, int, int, int, int);
@@ -877,6 +877,15 @@ void m_snd_tag_destroy(struct m_snd_tag *);
void m_rcvif_serialize(struct mbuf *);
struct ifnet *m_rcvif_restore(struct mbuf *);
+static __inline struct mbuf *
+m_pullup(struct mbuf *m, int len)
+{
+ if (__predict_false(m->m_len < len))
+ return (__m_pullup(m, len));
+ else
+ return (m);
+}
+
static __inline int
m_gettype(int size)
{