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

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