summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeongjun Hong <hsj0512@snu.ac.kr>2026-10-06 14:16:45 +0000
committerPaolo Abeni <pabeni@redhat.com>2026-10-12 16:30:21 +0200
commit29f144016f03608abfddcd6ebaeabafd7aeaadd2 (patch)
tree3217e60164a7d19da7cc2374012f19ed57891176
parent3a82195416fd71fdd6cb4ff80f611ec28073be16 (diff)
downloadlinux-next-29f144016f03608abfddcd6ebaeabafd7aeaadd2.tar.gz
linux-next-29f144016f03608abfddcd6ebaeabafd7aeaadd2.zip
net/mlx5: allocate DMA pool structs on the pool's NUMA node
The mlx5 DMA pool structs (mlx5_dma_pool, mlx5_dma_pool_page and its block bitmap, and mlx5_frag_buf_node_pools) are allocated without a node hint, so they land on the node of whichever CPU happens to create or fill the pool, while the DMA pages they describe are allocated on the pool's node. The pool, page and bitmap are dereferenced on every block allocation and free. Allocate them on the pool's NUMA node as well, so that all of a pool's state lives on one node. These allocations happen on the control path, so the performance gain is expected to be small; the change is mainly for consistency. Signed-off-by: Seongjun Hong <hsj0512@snu.ac.kr> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20261006-net-mlx5-numa-allocate-pool-page-v2-1-0dc4c2eb1376@snu.ac.kr Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/alloc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
index a92cf545bdaf..dcd281c4691d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
@@ -110,7 +110,7 @@ static struct mlx5_dma_pool *mlx5_dma_pool_create(struct mlx5_core_dev *dev,
{
struct mlx5_dma_pool *pool;
- pool = kzalloc_obj(*pool);
+ pool = kzalloc_node(sizeof(*pool), GFP_KERNEL, node);
if (!pool)
return NULL;
@@ -127,19 +127,20 @@ mlx5_dma_pool_page_alloc(struct mlx5_dma_pool *pool)
{
int blocks_per_page = BIT(PAGE_SHIFT - pool->block_shift);
struct mlx5_dma_pool_page *page;
+ int node = pool->node;
- page = kzalloc_obj(*page);
+ page = kzalloc_node(sizeof(*page), GFP_KERNEL, node);
if (!page)
goto err_out;
page->pool = pool;
- page->bitmap = bitmap_zalloc(blocks_per_page, GFP_KERNEL);
+ page->bitmap = bitmap_zalloc_node(blocks_per_page, GFP_KERNEL, node);
if (!page->bitmap)
goto err_free_page;
bitmap_fill(page->bitmap, blocks_per_page);
page->buf = mlx5_dma_zalloc_coherent_node(pool->dev, PAGE_SIZE,
- &page->dma, pool->node);
+ &page->dma, node);
if (!page->buf)
goto err_free_bitmap;
@@ -278,7 +279,7 @@ mlx5_frag_buf_node_pools_create(struct mlx5_core_dev *dev, int node)
{
struct mlx5_frag_buf_node_pools *node_pools;
- node_pools = kzalloc_obj(*node_pools);
+ node_pools = kzalloc_node(sizeof(*node_pools), GFP_KERNEL, node);
if (!node_pools)
return NULL;