From nobody Tue Jun 11 01:33:50 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VyrmZ1wR0z5NLQR; Tue, 11 Jun 2024 01:33:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VyrmZ1Qlsz4n1r; Tue, 11 Jun 2024 01:33:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718069630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cptJ0DlMG35yLKgs4bpuIcgWduHvYoe9B6DMPFiYYdM=; b=kJWbvR8o+HrUa3PcujACkAfCZmTsB/EiBqGeao+Bf2HKqlHNkgseawng0ZH8JsacMfTKmr UOnv6JwZIwFGDZZ832QqLDgmHgXUZGO49SefQFE8W68vFAad6ig9+q0hsoPLP4Eu+nBICS PpN+75ufxnKrcaSwihwg6RvB8ISAX+NBnGoJz9ZVWHdf3Uxckcl2jYo6V59wfhxo73BTc4 mLWho+GsVAcFctRCU8RueLwb+VT104NSFHYBd2DAPPTbm+DzayrMK9l8kImmfYN/SumVbT X/Vb8ybaRSYti3PptnFqRZrszcB5VUF0PBqGqxhDoYCk/4qav5mproAEAIVqow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718069630; a=rsa-sha256; cv=none; b=qDVcl/b/7bMc01mehPHnxSkpYQcwWbBc+Igsfk6B+vYR7NRfsSUPt351Dhi5DzLFExWlZ4 ZVpTtWp2PYMTpQz3c9n1rczVbtkSDhT005UJk2ZujW8Cdr5BabYIK+//emWS6hMB5a/YMC SK1bjt2qZts3Nr8+NYTgQTOxu2Ps9j3lryd3IlJi2HWte103MTL4rs+eYs/XzwtqFL+eYb AVrsDCz8GzePXfAcKflaN8kh6S3ynvxxaEdEgDF2abGqolKlS8ZSZ2gnhEKxuxcHXI92Rc GNfbJblv8EM9uvJVldaE5rpIO7RwjlGYO+yaaweSmhxmeDgrxCbE6xdJdFOBeA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718069630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cptJ0DlMG35yLKgs4bpuIcgWduHvYoe9B6DMPFiYYdM=; b=Bi3eFAGl9TYU0a+ar6BfnU54ADKLIzeVlt7/7lyHqk2InhIg7EALoI6U9dCZK/ab1wsmoA 0AgGfsvg8KxIytKZp5mWPCXngyyH3eaaBnKSbJP+NtqhpLpjV5i2Ves+YkvPjO8nFxNQ7W kYEo7CtgKBSQRHHRFV4tPqauTshlrksP+ILomOVqwUSJi6uBl75w2XGuLeSbxhHVbDjuJa VeNwUx13n83HjSni/Jyz25dtL/bPcfk0Le+oj2XQNK3XlzHIWTkENyz8ceDsArdVvukt8V fxwUGeb8TCUNcZVnG79zfHi/PO1dUtJmgOk1GO0xqX7q6k1bpiDiWnYk2d4+TQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VyrmZ11tpzq3m; Tue, 11 Jun 2024 01:33:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45B1XoKs068679; Tue, 11 Jun 2024 01:33:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45B1Xo9c068676; Tue, 11 Jun 2024 01:33:50 GMT (envelope-from git) Date: Tue, 11 Jun 2024 01:33:50 GMT Message-Id: <202406110133.45B1Xo9c068676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Smirnoff Subject: git: a3f7b81fdd22 - stable/14 - mbuf: provide m_freemp() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a3f7b81fdd2205207085ba5d038b402aba748c6e Auto-Submitted: auto-generated The branch stable/14 has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=a3f7b81fdd2205207085ba5d038b402aba748c6e commit a3f7b81fdd2205207085ba5d038b402aba748c6e Author: Gleb Smirnoff AuthorDate: 2024-06-11 01:31:02 +0000 Commit: Gleb Smirnoff CommitDate: 2024-06-11 01:31:02 +0000 mbuf: provide m_freemp() This function follows both m_nextpkt and m_next linkage freeing all mbufs. Note that existing m_freem() follows only m_next. Reviewed by: khng Differential Revision: https://reviews.freebsd.org/D45477 (cherry picked from commit badf44cc21249a56e7d822a77acfdd21f8352d50) --- sys/kern/kern_mbuf.c | 19 +++++++++++++++++++ sys/kern/uipc_mbuf.c | 3 +++ sys/sys/mbuf.h | 2 ++ 3 files changed, 24 insertions(+) diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 0897ac4cc2db..002e508e91cc 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1569,6 +1569,25 @@ m_freem(struct mbuf *mb) mb = m_free(mb); } +/* + * Free an entire chain of mbufs and associated external buffers, following + * both m_next and m_nextpkt linkage. + * Note: doesn't support NULL argument. + */ +void +m_freemp(struct mbuf *m) +{ + struct mbuf *n; + + MBUF_PROBE1(m__freemp, m); + do { + n = m->m_nextpkt; + while (m != NULL) + m = m_free(m); + m = n; + } while (m != NULL); +} + /* * Temporary primitive to allow freeing without going through m_free. */ diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index f1e986eaa348..b10e524e6e4b 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -113,6 +113,9 @@ SDT_PROBE_DEFINE1_XLATE(sdt, , , m__free, SDT_PROBE_DEFINE1_XLATE(sdt, , , m__freem, "struct mbuf *", "mbufinfo_t *"); +SDT_PROBE_DEFINE1_XLATE(sdt, , , m__freemp, + "struct mbuf *", "mbufinfo_t *"); + #include /* diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 757eba3165f9..f7925da795cd 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -67,6 +67,7 @@ SDT_PROBE_DECLARE(sdt, , , m__cljget); SDT_PROBE_DECLARE(sdt, , , m__cljset); SDT_PROBE_DECLARE(sdt, , , m__free); SDT_PROBE_DECLARE(sdt, , , m__freem); +SDT_PROBE_DECLARE(sdt, , , m__freemp); #endif /* _KERNEL */ @@ -844,6 +845,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_freemp(struct mbuf *); void m_free_raw(struct mbuf *); struct mbuf *m_get2(int, int, short, int); struct mbuf *m_get3(int, int, short, int);