[PATCH v2] RDMA/irdma: Use kvzalloc for paged memory DMA address array

carlos.bilbao@kernel.org posted 1 patch 1 week, 3 days ago
drivers/infiniband/hw/irdma/utils.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH v2] RDMA/irdma: Use kvzalloc for paged memory DMA address array
Posted by carlos.bilbao@kernel.org 1 week, 3 days ago
From: Carlos Bilbao <carlos.bilbao@kernel.org>

Allocate array chunk->dmainfo.dmaaddrs using kvzalloc() to allow the
allocation to fall back to vmalloc when contiguous memory is unavailable
(instead of failing and logging page allocation warnings).

Acked-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Signed-off-by: Carlos Bilbao (Lambda) <carlos.bilbao@kernel.org>
---
 drivers/infiniband/hw/irdma/utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c
index 13d7499131d4..6aac6d314564 100644
--- a/drivers/infiniband/hw/irdma/utils.c
+++ b/drivers/infiniband/hw/irdma/utils.c
@@ -2239,7 +2239,7 @@ void irdma_pble_free_paged_mem(struct irdma_chunk *chunk)
 				 chunk->pg_cnt);
 
 done:
-	kfree(chunk->dmainfo.dmaaddrs);
+	kvfree(chunk->dmainfo.dmaaddrs);
 	chunk->dmainfo.dmaaddrs = NULL;
 	vfree(chunk->vaddr);
 	chunk->vaddr = NULL;
@@ -2256,7 +2256,7 @@ int irdma_pble_get_paged_mem(struct irdma_chunk *chunk, u32 pg_cnt)
 	u32 size;
 	void *va;
 
-	chunk->dmainfo.dmaaddrs = kzalloc(pg_cnt << 3, GFP_KERNEL);
+	chunk->dmainfo.dmaaddrs = kvzalloc(pg_cnt << 3, GFP_KERNEL);
 	if (!chunk->dmainfo.dmaaddrs)
 		return -ENOMEM;
 
@@ -2277,7 +2277,7 @@ int irdma_pble_get_paged_mem(struct irdma_chunk *chunk, u32 pg_cnt)
 
 	return 0;
 err:
-	kfree(chunk->dmainfo.dmaaddrs);
+	kvfree(chunk->dmainfo.dmaaddrs);
 	chunk->dmainfo.dmaaddrs = NULL;
 
 	return -ENOMEM;
-- 
2.43.0
Re: [PATCH v2] RDMA/irdma: Use kvzalloc for paged memory DMA address array
Posted by Leon Romanovsky 1 week, 3 days ago
On Tue, 27 Jan 2026 17:44:46 -0800, carlos.bilbao@kernel.org wrote:
> Allocate array chunk->dmainfo.dmaaddrs using kvzalloc() to allow the
> allocation to fall back to vmalloc when contiguous memory is unavailable
> (instead of failing and logging page allocation warnings).
> 
> 

Applied, thanks!

[1/1] RDMA/irdma: Use kvzalloc for paged memory DMA address array
      https://git.kernel.org/rdma/rdma/c/959d2c356e32ab

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>