From: Leon Romanovsky <leon@kernel.org>
To: Potnuri Bharat Teja <bharat@chelsio.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Yishai Hadas <yishaih@nvidia.com>,
Nelson Escobar <neescoba@cisco.com>,
Satish Kharat <satishkh@cisco.com>
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
Mike Rapoport <rppt@kernel.org>
Subject: [PATCH rdma-next 2/4] RDMA/mlx4: use kzalloc() for the fast registration page list
Date: Wed, 15 Jul 2026 14:03:10 +0300 [thread overview]
Message-ID: <20260715-get_pages-to-kmalloc-v1-2-b0b7fce288be@nvidia.com> (raw)
In-Reply-To: <20260715-get_pages-to-kmalloc-v1-0-b0b7fce288be@nvidia.com>
From: Leon Romanovsky <leonro@nvidia.com>
mlx4_alloc_priv_pages() allocates a zeroed, page-sized buffer for a
DMA-to-device page list. kmalloc() provides the required physical
contiguity, and a PAGE_SIZE allocation retains the alignment needed to
keep the list within one page.
Use kzalloc() for the buffer and kfree() on the error and teardown paths.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/infiniband/hw/mlx4/mr.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c
index 761e2c05dd0f..a6b4abce1bfe 100644
--- a/drivers/infiniband/hw/mlx4/mr.c
+++ b/drivers/infiniband/hw/mlx4/mr.c
@@ -313,7 +313,7 @@ mlx4_alloc_priv_pages(struct ib_device *device,
MLX4_MR_PAGES_ALIGN);
/* Prevent cross page boundary allocation. */
- mr->pages = (__be64 *)get_zeroed_page(GFP_KERNEL);
+ mr->pages = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!mr->pages)
return -ENOMEM;
@@ -328,7 +328,7 @@ mlx4_alloc_priv_pages(struct ib_device *device,
return 0;
err:
- free_page((unsigned long)mr->pages);
+ kfree(mr->pages);
return ret;
}
@@ -340,7 +340,7 @@ mlx4_free_priv_pages(struct mlx4_ib_mr *mr)
dma_unmap_single(device->dev.parent, mr->page_map,
mr->page_map_size, DMA_TO_DEVICE);
- free_page((unsigned long)mr->pages);
+ kfree(mr->pages);
mr->pages = NULL;
}
}
--
2.55.0
next prev parent reply other threads:[~2026-07-15 11:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 11:03 [PATCH rdma-next 0/4] RDMA: use kmalloc() for remaining scratch buffers Leon Romanovsky
2026-07-15 11:03 ` [PATCH rdma-next 1/4] RDMA/cxgb4: use kmalloc() for the PBL address array Leon Romanovsky
2026-07-15 11:03 ` Leon Romanovsky [this message]
2026-07-15 11:03 ` [PATCH rdma-next 3/4] RDMA/usnic: use kmalloc() for the page pointer array Leon Romanovsky
2026-07-15 11:03 ` [PATCH rdma-next 4/4] RDMA/mlx5: use kmalloc() for UMR translation buffers Leon Romanovsky
2026-07-16 5:52 ` [PATCH rdma-next 0/4] RDMA: use kmalloc() for remaining scratch buffers Mike Rapoport
2026-07-16 9:03 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260715-get_pages-to-kmalloc-v1-2-b0b7fce288be@nvidia.com \
--to=leon@kernel.org \
--cc=bharat@chelsio.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=neescoba@cisco.com \
--cc=rppt@kernel.org \
--cc=satishkh@cisco.com \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®