diff mbox series

[net-next] net/mlx5: Pick the first matched node of priv.free_list in alloc_4k

Message ID 20240823061648.17862-1-lirongqing@baidu.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net/mlx5: Pick the first matched node of priv.free_list in alloc_4k | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for 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, 7 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-08-25--21-00 (tests: 714)

Commit Message

Li,Rongqing Aug. 23, 2024, 6:16 a.m. UTC
Pick the first node instead of last, to avoid unnecessary iterating
over whole free list

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Li,Rongqing Dec. 13, 2024, 4:43 a.m. UTC | #1
> Pick the first node instead of last, to avoid unnecessary iterating over whole
> free list
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> index 972e8e9..cd20f11 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> @@ -228,6 +228,7 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64
> *addr, u32 function)
>  		if (iter->function != function)
>  			continue;
>  		fp = iter;
> +		break;
>  	}
> 
>  	if (list_empty(&dev->priv.free_list) || !fp)
> --


ping

> 2.9.4
Zhu Yanjun Dec. 13, 2024, 7:26 a.m. UTC | #2
在 2024/8/23 8:16, Li RongQing 写道:
> Pick the first node instead of last, to avoid unnecessary iterating
> over whole free list
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Your commit is to fix the problem from the following commit?
So the following should be needed.

Fixes: 2726cd4a2928 ("net/mlx5: Dedicate fw page to the requesting function"

commit 2726cd4a29280c20ea983be285a6aefe75b205a4
Author: Eran Ben Elisha <eranbe@mellanox.com>
Date:   Sun May 3 10:15:58 2020 +0300

     net/mlx5: Dedicate fw page to the requesting function

     The cited patch assumes that all chuncks in a fw page belong to the 
same
     function, thus the driver must dedicate fw page to the requesting
     function, which is actually what was intedned in the original fw pages
     allocator design, hence the fwp->func_id !

     Up until the cited patch everything worked ok, but now "relase all 
pages"
     is broken on systems with page_size > 4k.

     Fix this by dedicating fw page to the requesting function id via 
adding a
     func_id parameter to alloc_4k() function.

     Fixes: c6168161f693 ("net/mlx5: Add support for release all pages 
event")
     Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
     Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>

Zhu Yanjun

> ---
>   drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> index 972e8e9..cd20f11 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> @@ -228,6 +228,7 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr, u32 function)
>   		if (iter->function != function)
>   			continue;
>   		fp = iter;
> +		break;
>   	}
>   
>   	if (list_empty(&dev->priv.free_list) || !fp)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index 972e8e9..cd20f11 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -228,6 +228,7 @@  static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr, u32 function)
 		if (iter->function != function)
 			continue;
 		fp = iter;
+		break;
 	}
 
 	if (list_empty(&dev->priv.free_list) || !fp)