public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][rdma-next] RDMA/mlx5: Use NUMA-aware allocation for memory region descriptors
@ 2026-02-24  9:07 lirongqing
  2026-03-06  5:23 ` 答复: " Li,Rongqing(ACG CCN)
  0 siblings, 1 reply; 3+ messages in thread
From: lirongqing @ 2026-02-24  9:07 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky, linux-rdma; +Cc: Li RongQing

From: Li RongQing <lirongqing@baidu.com>

The mlx5_alloc_priv_descs() function currently uses kzalloc(), which
allocates memory on the NUMA node of the calling CPU. On multi-socket
systems, this can lead to cross-node memory access if the HCA is
attached to a different NUMA node than the process allocating the
Memory Region (MR).

Switch to kzalloc_node() and specify the node associated with the
HCA's DMA device. This ensures that the MR descriptors are resident on
the local NUMA node, reducing latency for hardware access.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/infiniband/hw/mlx5/mr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 665323b..5f4b4da 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1990,7 +1990,8 @@ mlx5_alloc_priv_descs(struct ib_device *device,
 		add_size = min_t(int, end - size, add_size);
 	}
 
-	mr->descs_alloc = kzalloc(size + add_size, GFP_KERNEL);
+	mr->descs_alloc = kzalloc_node(size + add_size, GFP_KERNEL,
+			dev_to_node(ddev));
 	if (!mr->descs_alloc)
 		return -ENOMEM;
 
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* 答复: [PATCH][rdma-next] RDMA/mlx5: Use NUMA-aware allocation for memory region descriptors
  2026-02-24  9:07 [PATCH][rdma-next] RDMA/mlx5: Use NUMA-aware allocation for memory region descriptors lirongqing
@ 2026-03-06  5:23 ` Li,Rongqing(ACG CCN)
  2026-03-08 12:46   ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Li,Rongqing(ACG CCN) @ 2026-03-06  5:23 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky, linux-rdma@vger.kernel.org


> The mlx5_alloc_priv_descs() function currently uses kzalloc(), which allocates
> memory on the NUMA node of the calling CPU. On multi-socket systems, this
> can lead to cross-node memory access if the HCA is attached to a different
> NUMA node than the process allocating the Memory Region (MR).
> 
> Switch to kzalloc_node() and specify the node associated with the HCA's DMA
> device. This ensures that the MR descriptors are resident on the local NUMA
> node, reducing latency for hardware access.
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

ping

[Li,Rongqing] 



> ---
>  drivers/infiniband/hw/mlx5/mr.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index 665323b..5f4b4da 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -1990,7 +1990,8 @@ mlx5_alloc_priv_descs(struct ib_device *device,
>  		add_size = min_t(int, end - size, add_size);
>  	}
> 
> -	mr->descs_alloc = kzalloc(size + add_size, GFP_KERNEL);
> +	mr->descs_alloc = kzalloc_node(size + add_size, GFP_KERNEL,
> +			dev_to_node(ddev));
>  	if (!mr->descs_alloc)
>  		return -ENOMEM;
> 
> --
> 2.9.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 答复: [PATCH][rdma-next] RDMA/mlx5: Use NUMA-aware allocation for memory region descriptors
  2026-03-06  5:23 ` 答复: " Li,Rongqing(ACG CCN)
@ 2026-03-08 12:46   ` Leon Romanovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2026-03-08 12:46 UTC (permalink / raw)
  To: Li,Rongqing(ACG CCN); +Cc: Jason Gunthorpe, linux-rdma@vger.kernel.org

On Fri, Mar 06, 2026 at 05:23:07AM +0000, Li,Rongqing(ACG CCN) wrote:
> 
> > The mlx5_alloc_priv_descs() function currently uses kzalloc(), which allocates
> > memory on the NUMA node of the calling CPU. On multi-socket systems, this
> > can lead to cross-node memory access if the HCA is attached to a different
> > NUMA node than the process allocating the Memory Region (MR).
> > 
> > Switch to kzalloc_node() and specify the node associated with the HCA's DMA
> > device. This ensures that the MR descriptors are resident on the local NUMA
> > node, reducing latency for hardware access.
> > 
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> 
> ping
> 
> [Li,Rongqing] 

I have no plans to merge these patches in RDMA subsystem. It is unlikely
can give any benefit to the performance.

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-08 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24  9:07 [PATCH][rdma-next] RDMA/mlx5: Use NUMA-aware allocation for memory region descriptors lirongqing
2026-03-06  5:23 ` 答复: " Li,Rongqing(ACG CCN)
2026-03-08 12:46   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox