aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@nvidia.com>2026-07-16 05:03:31 -0400
committerLeon Romanovsky <leon@kernel.org>2026-07-20 09:45:43 -0400
commitce5322367c4bd00e51560ffdc07c6c619952967a (patch)
tree48048d9fd1d672640b859e041a67bd35527d7977
parentRDMA/cxgb4: use kmalloc() for the PBL address array (diff)
RDMA/mlx4: use kzalloc() for the fast registration page list
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. Link: https://patch.msgid.link/20260715-get_pages-to-kmalloc-v1-2-b0b7fce288be@nvidia.com Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
-rw-r--r--drivers/infiniband/hw/mlx4/mr.c6
1 files 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;
}
}