[PATCH rdma-next 0/4] RDMA: use kmalloc() for remaining scratch buffers

Leon Romanovsky posted 4 patches 1 week, 3 days ago
drivers/infiniband/hw/cxgb4/mem.c        |  4 ++--
drivers/infiniband/hw/mlx4/mr.c          |  6 +++---
drivers/infiniband/hw/mlx5/main.c        |  8 ++++----
drivers/infiniband/hw/mlx5/umr.c         | 11 +++++------
drivers/infiniband/hw/usnic/usnic_uiom.c |  4 ++--
5 files changed, 16 insertions(+), 17 deletions(-)
[PATCH rdma-next 0/4] RDMA: use kmalloc() for remaining scratch buffers
Posted by Leon Romanovsky 1 week, 3 days ago
The series [PATCH v2 0/5] RDMA, IB: replace __get_free_pages() with
kmalloc() [1] replaced direct page allocator use in RDMA buffers that
have no page-specific requirements. Continue that cleanup for the remaining
scratch buffers in cxgb4, mlx4, usnic and mlx5.

Use kmalloc() or kzalloc() to retain the existing physically contiguous
storage and alignment while avoiding casts and allowing kfree() to derive
the allocation size. The mlx5 patch converts every allocation tier in the
shared UMR buffer allocator so its cleanup path does not mix allocator
families.

Allocations in qedr, cxgb4 and bnxt_re that back userspace mappings are
intentionally unchanged. Those buffers are passed to vm_insert_page() or
io_remap_pfn_range() and must remain individual page allocations rather
than slab pages.

[1] https://lore.kernel.org/all/20260713-b4-rdma-v2-0-65d2a1a5180c@kernel.org/

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
Leon Romanovsky (4):
      RDMA/cxgb4: use kmalloc() for the PBL address array
      RDMA/mlx4: use kzalloc() for the fast registration page list
      RDMA/usnic: use kmalloc() for the page pointer array
      RDMA/mlx5: use kmalloc() for UMR translation buffers

 drivers/infiniband/hw/cxgb4/mem.c        |  4 ++--
 drivers/infiniband/hw/mlx4/mr.c          |  6 +++---
 drivers/infiniband/hw/mlx5/main.c        |  8 ++++----
 drivers/infiniband/hw/mlx5/umr.c         | 11 +++++------
 drivers/infiniband/hw/usnic/usnic_uiom.c |  4 ++--
 5 files changed, 16 insertions(+), 17 deletions(-)
---
base-commit: e952e079d226209a132110acc1de96a099701292
change-id: 20260715-get_pages-to-kmalloc-fff6f623114e

Best regards,
--  
Leon Romanovsky <leonro@nvidia.com>
Re: [PATCH rdma-next 0/4] RDMA: use kmalloc() for remaining scratch buffers
Posted by Leon Romanovsky 1 week, 2 days ago
On Wed, 15 Jul 2026 14:03:08 +0300, Leon Romanovsky wrote:
> The series [PATCH v2 0/5] RDMA, IB: replace __get_free_pages() with
> kmalloc() [1] replaced direct page allocator use in RDMA buffers that
> have no page-specific requirements. Continue that cleanup for the remaining
> scratch buffers in cxgb4, mlx4, usnic and mlx5.
> 
> Use kmalloc() or kzalloc() to retain the existing physically contiguous
> storage and alignment while avoiding casts and allowing kfree() to derive
> the allocation size. The mlx5 patch converts every allocation tier in the
> shared UMR buffer allocator so its cleanup path does not mix allocator
> families.
> 
> [...]

Applied, thanks!

[1/4] RDMA/cxgb4: use kmalloc() for the PBL address array
      https://git.kernel.org/rdma/rdma/c/8d478a35ddd99c
[2/4] RDMA/mlx4: use kzalloc() for the fast registration page list
      https://git.kernel.org/rdma/rdma/c/1c549b0722a81d
[3/4] RDMA/usnic: use kmalloc() for the page pointer array
      https://git.kernel.org/rdma/rdma/c/50ba3490bf1567
[4/4] RDMA/mlx5: use kmalloc() for UMR translation buffers
      https://git.kernel.org/rdma/rdma/c/94db8be4a1772d

Best regards,
-- 
Leon Romanovsky <leonro@nvidia.com>
Re: [PATCH rdma-next 0/4] RDMA: use kmalloc() for remaining scratch buffers
Posted by Mike Rapoport 1 week, 2 days ago
On Wed, Jul 15, 2026 at 02:03:08PM +0300, Leon Romanovsky wrote:
> The series [PATCH v2 0/5] RDMA, IB: replace __get_free_pages() with
> kmalloc() [1] replaced direct page allocator use in RDMA buffers that
> have no page-specific requirements. Continue that cleanup for the remaining
> scratch buffers in cxgb4, mlx4, usnic and mlx5.
> 
> Use kmalloc() or kzalloc() to retain the existing physically contiguous
> storage and alignment while avoiding casts and allowing kfree() to derive
> the allocation size. The mlx5 patch converts every allocation tier in the
> shared UMR buffer allocator so its cleanup path does not mix allocator
> families.
> 
> Allocations in qedr, cxgb4 and bnxt_re that back userspace mappings are
> intentionally unchanged. Those buffers are passed to vm_insert_page() or
> io_remap_pfn_range() and must remain individual page allocations rather
> than slab pages.
> 
> [1] https://lore.kernel.org/all/20260713-b4-rdma-v2-0-65d2a1a5180c@kernel.org/
> 
> Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>

Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

Thanks, Leon!

-- 
Sincerely yours,
Mike.