diff mbox series

net/mlx5: Node-aware allocation for mlx5_buf_list

Message ID 20240906061115.522074-1-adamli@os.amperecomputing.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series net/mlx5: Node-aware allocation for mlx5_buf_list | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-07--06-00 (tests: 722)

Commit Message

Adam Li Sept. 6, 2024, 6:11 a.m. UTC
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(-)

Comments

Leon Romanovsky Sept. 10, 2024, 12:11 p.m. UTC | #1
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>
Adam Li Oct. 12, 2024, 2:39 a.m. UTC | #2
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
diff mbox series

Patch

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;