* [PATCH] net/mlx5: Node-aware allocation for mlx5_buf_list
@ 2024-09-06 6:11 Adam Li
2024-09-10 12:11 ` Leon Romanovsky
[not found] ` <ZuCv8VyJqoChZLIx@x130>
0 siblings, 2 replies; 3+ messages in thread
From: Adam Li @ 2024-09-06 6:11 UTC (permalink / raw)
To: saeedm, leon, tariqt, davem, edumazet, kuba, pabeni
Cc: netdev, linux-rdma, linux-kernel, patches, cl, shijie, Adam Li,
Christoph Lameter
Allocation for mlx5_frag_buf.frags[i].buf is node-aware.
Make mlx5_frag_buf.frags allocation node-aware too.
Signed-off-by: Adam Li <adamli@os.amperecomputing.com>
Reviewed-by: Christoph Lameter (Ampere) <cl@linux.com>
---
drivers/net/ethernet/mellanox/mlx5/core/alloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
index 6aca004e88cd..fda17b41ff17 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
@@ -79,8 +79,8 @@ int mlx5_frag_buf_alloc_node(struct mlx5_core_dev *dev, int size,
buf->size = size;
buf->npages = DIV_ROUND_UP(size, PAGE_SIZE);
buf->page_shift = PAGE_SHIFT;
- buf->frags = kcalloc(buf->npages, sizeof(struct mlx5_buf_list),
- GFP_KERNEL);
+ buf->frags = kcalloc_node(buf->npages, sizeof(struct mlx5_buf_list),
+ GFP_KERNEL, node);
if (!buf->frags)
goto err_out;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net/mlx5: Node-aware allocation for mlx5_buf_list
2024-09-06 6:11 [PATCH] net/mlx5: Node-aware allocation for mlx5_buf_list Adam Li
@ 2024-09-10 12:11 ` Leon Romanovsky
[not found] ` <ZuCv8VyJqoChZLIx@x130>
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2024-09-10 12:11 UTC (permalink / raw)
To: Adam Li
Cc: saeedm, tariqt, davem, edumazet, kuba, pabeni, netdev, linux-rdma,
linux-kernel, patches, cl, shijie, Christoph Lameter
On Fri, Sep 06, 2024 at 06:11:15AM +0000, Adam Li wrote:
> Allocation for mlx5_frag_buf.frags[i].buf is node-aware.
> Make mlx5_frag_buf.frags allocation node-aware too.
>
> Signed-off-by: Adam Li <adamli@os.amperecomputing.com>
> Reviewed-by: Christoph Lameter (Ampere) <cl@linux.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/alloc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/mlx5: Node-aware allocation for mlx5_buf_list
[not found] ` <ZuCv8VyJqoChZLIx@x130>
@ 2024-10-12 2:39 ` Adam Li
0 siblings, 0 replies; 3+ messages in thread
From: Adam Li @ 2024-10-12 2:39 UTC (permalink / raw)
To: Saeed Mahameed
Cc: leon, tariqt, davem, edumazet, kuba, pabeni, netdev, linux-rdma,
linux-kernel, patches, Lameter, Christopher, shijie, cl, Adam Li
Hi Saeed,
Very sorry for the slow reply.
On 9/11/2024 4:45 AM, Saeed Mahameed wrote:
> On 06 Sep 06:11, Adam Li wrote:
>> Allocation for mlx5_frag_buf.frags[i].buf is node-aware.
>> Make mlx5_frag_buf.frags allocation node-aware too.
>>
>
> Why ? buf is accessed by the device but "frags" only accessed by CPU.
>
Yes, this patch hopes to minimize CPU cross node memory access.
I observed 'frags' is accessed on RX path from mlx5e_alloc_rx_mpwqe().
>> Signed-off-by: Adam Li <adamli@os.amperecomputing.com>
>> Reviewed-by: Christoph Lameter (Ampere) <cl@linux.com>
>> ---
>> drivers/net/ethernet/mellanox/mlx5/core/alloc.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
>> index 6aca004e88cd..fda17b41ff17 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
>> @@ -79,8 +79,8 @@ int mlx5_frag_buf_alloc_node(struct mlx5_core_dev *dev, int size,
>> buf->size = size;
>> buf->npages = DIV_ROUND_UP(size, PAGE_SIZE);
>> buf->page_shift = PAGE_SHIFT;
>> - buf->frags = kcalloc(buf->npages, sizeof(struct mlx5_buf_list),
>> - GFP_KERNEL);
>> + buf->frags = kcalloc_node(buf->npages, sizeof(struct mlx5_buf_list),
>> + GFP_KERNEL, node);
>> if (!buf->frags)
>> goto err_out;
>>
>> --
>> 2.25.1
>>
>>
Thanks,
-adam
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-12 2:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 6:11 [PATCH] net/mlx5: Node-aware allocation for mlx5_buf_list Adam Li
2024-09-10 12:11 ` Leon Romanovsky
[not found] ` <ZuCv8VyJqoChZLIx@x130>
2024-10-12 2:39 ` Adam Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).