From nobody Mon Jun 22 18:37:52 2026 X-Original-To: dev-commits-src-main@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 4gkcQ868Bsz6hnJc for ; Mon, 22 Jun 2026 18:37:52 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gkcQ83Y07z3nwW for ; Mon, 22 Jun 2026 18:37:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782153472; 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=b8+mFdDGY1SQJPSpTbchArN6aAr/MkJruX6TcKpCcqg=; b=VZ9mz2Pe5lnmHNyU3QGVo8hTDYrnQoCIbU0DQ2C5F/foYJzl8s7ct6rNWx+vEZkyXracVm cNQhaDf2G1eZ9iNs1yptdrQxtaupKl34cFD9o4rlhfH0aYnZcT9nw7GgtFBQn13+/FejBe E6RFRpTW+ARLVSGaWtulZ9Yd8/1Gq6NSvdAv2ybIC/faJW+p7/vnuv1X1Nb6GxKq35xTi3 XYA5eyfiWz9spEbKoft6jgUhH0lw/MHeZTsJ1dYja4wNswu1XpAnlCLTiqSjvqviE1wkfH Val8LpP0IzwiDcrMtGmBQbQ94giR/4u/DpFRiOPfvrFkajGu3LMna/v4ksWCPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782153472; a=rsa-sha256; cv=none; b=Z0yYkkTVHquMHm+ImtsSzqArj2tOYOx6MDQ2M+5pPb7zlRKnqr+KkDTQ1qW1bcOVz/b33x 8snBnSm1xu/AgfE9p6Tpt4dmD99x0J0kPQVor3929sQtL66R5cjeenb554P66IwGMQXPhR 5BkQl7pZOM/iayiQjSetu/bcMf2y3pEspP/67akXalZ4bZekmWbBm1Ohy9D4VyuNeIlIGW E/1/NTzYFOCGDHGQgps7COedf01hDWWk1UaPGHxhsbJy91qZ/S7GY20Qbg6WUgjXp6SgLC YsFcG9shCJUFtqBdXz6SkWl+TffG2pabEzY1npDCsVmQcJkdoygE3/DubCNqAg== 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=1782153472; 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=b8+mFdDGY1SQJPSpTbchArN6aAr/MkJruX6TcKpCcqg=; b=kM4B5Fh96/+/mNEVBiCnKoBH2HPRwkJSWVJVcZ01qtPYA8Zw6xhx/IfIcU0V+NywaKiRqT Hxwc60hvf03xlCUpM612xqHjYIqKhhKaQW0iC7Aw8h5mpRAr12mIZdf93YDC3oen/XVmMZ whZhIlRMm5ud3maRoirxn/ad6Rgm6sB5cXEI5a+WHa+EtqSkzPs5kzce6o54vNOkBVFd23 0/2YEPbp8Rg44g2v0Xwm6kxJJrMzs8coZPeEiUJ2Er6KtiZjREbeN+BZOGgS9i0qfgzN8r VstlpN3jeRvFlQg4LPqAH44FOyuyoWcLfYSeYf1T7UP8JF+ZqxSFI3NlmYWJRA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gkcQ82QRtz109v for ; Mon, 22 Jun 2026 18:37:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32e8f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 22 Jun 2026 18:37:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: fbe76ea44c4b - main - OFED: Use vmalloc() and vzalloc() in various places List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbe76ea44c4b35ff1226b19c8e3913716686e4f4 Auto-Submitted: auto-generated Date: Mon, 22 Jun 2026 18:37:52 +0000 Message-Id: <6a398100.32e8f.2ab37d3b@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fbe76ea44c4b35ff1226b19c8e3913716686e4f4 commit fbe76ea44c4b35ff1226b19c8e3913716686e4f4 Author: John Baldwin AuthorDate: 2026-05-28 15:52:03 +0000 Commit: John Baldwin CommitDate: 2026-06-22 18:36:52 +0000 OFED: Use vmalloc() and vzalloc() in various places This contains changes from the following Linux commits: 10313cbb9220 IPoIB: Allocate priv->tx_ring with vmalloc() b1404069f644 IPoIB/cm: Use vmalloc() to allocate rx_rings 948579cd8c6e RDMA: Use vzalloc() to replace vmalloc()+memset(0) Tested by: Wafa Hamzah (mlx5_ib) Tested by: John Baldwin (iw_cxgbe) Sponsored by: Chelsio Communications --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 17 +++++++---------- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c | 7 +++---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 03487afedd55..61db58d2b6c7 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -44,6 +44,7 @@ #include #include #include +#include int ipoib_max_conn_qp = 128; @@ -165,7 +166,7 @@ static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, m_freem(rx_ring[i].mb); } - kfree(rx_ring); + vfree(rx_ring); } static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv *priv) @@ -307,15 +308,13 @@ static int ipoib_cm_nonsrq_init_rx(struct ipoib_dev_priv *priv, int ret; int i; - rx->rx_ring = kzalloc(ipoib_recvq_size * sizeof *rx->rx_ring, GFP_KERNEL); + rx->rx_ring = vzalloc(ipoib_recvq_size * sizeof *rx->rx_ring); if (!rx->rx_ring) { printk(KERN_WARNING "%s: failed to allocate CM non-SRQ ring (%d entries)\n", priv->ca->name, ipoib_recvq_size); return -ENOMEM; } - memset(rx->rx_ring, 0, ipoib_recvq_size * sizeof *rx->rx_ring); - t = kmalloc(sizeof *t, GFP_KERNEL); if (!t) { ret = -ENOMEM; @@ -1007,13 +1006,12 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn, struct ipoib_dev_priv *priv = p->priv; int ret; - p->tx_ring = kzalloc(ipoib_sendq_size * sizeof *p->tx_ring, GFP_KERNEL); + p->tx_ring = vzalloc(ipoib_sendq_size * sizeof *p->tx_ring); if (!p->tx_ring) { ipoib_warn(priv, "failed to allocate tx ring\n"); ret = -ENOMEM; goto err_tx; } - memset(p->tx_ring, 0, ipoib_sendq_size * sizeof *p->tx_ring); p->qp = ipoib_cm_create_tx_qp(p->priv, p); if (IS_ERR(p->qp)) { @@ -1054,7 +1052,7 @@ err_id: ib_destroy_qp(p->qp); err_qp: p->qp = NULL; - kfree(p->tx_ring); + vfree(p->tx_ring); err_tx: return ret; } @@ -1105,7 +1103,7 @@ timeout: if (p->qp) ib_destroy_qp(p->qp); - kfree(p->tx_ring); + vfree(p->tx_ring); kfree(p); } @@ -1367,7 +1365,7 @@ static void ipoib_cm_create_srq(struct ipoib_dev_priv *priv, int max_sge) return; } - priv->cm.srq_ring = kzalloc(ipoib_recvq_size * sizeof *priv->cm.srq_ring, GFP_KERNEL); + priv->cm.srq_ring = vzalloc(ipoib_recvq_size * sizeof *priv->cm.srq_ring); if (!priv->cm.srq_ring) { printk(KERN_WARNING "%s: failed to allocate CM SRQ ring (%d entries)\n", priv->ca->name, ipoib_recvq_size); @@ -1376,7 +1374,6 @@ static void ipoib_cm_create_srq(struct ipoib_dev_priv *priv, int max_sge) return; } - memset(priv->cm.srq_ring, 0, ipoib_recvq_size * sizeof *priv->cm.srq_ring); } int ipoib_cm_dev_init(struct ipoib_dev_priv *priv) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c index f3a85f3a0cb7..fb1e34cfb215 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -799,13 +799,12 @@ ipoib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca, int port) goto out; } - priv->tx_ring = kzalloc(ipoib_sendq_size * sizeof *priv->tx_ring, GFP_KERNEL); + priv->tx_ring = vzalloc(ipoib_sendq_size * sizeof *priv->tx_ring); if (!priv->tx_ring) { printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n", ca->name, ipoib_sendq_size); goto out_rx_ring_cleanup; } - memset(priv->tx_ring, 0, ipoib_sendq_size * sizeof *priv->tx_ring); /* priv->tx_head, tx_tail & tx_outstanding are already 0 */ @@ -815,7 +814,7 @@ ipoib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca, int port) return 0; out_tx_ring_cleanup: - kfree(priv->tx_ring); + vfree(priv->tx_ring); out_rx_ring_cleanup: kfree(priv->rx_ring); @@ -866,7 +865,7 @@ ipoib_dev_cleanup(struct ipoib_dev_priv *priv) ipoib_ib_dev_cleanup(priv); kfree(priv->rx_ring); - kfree(priv->tx_ring); + vfree(priv->tx_ring); priv->rx_ring = NULL; priv->tx_ring = NULL;