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 Not Applicable
Headers show
Series [net-next] net/mlx5: Pick the first matched node of priv.free_list in alloc_4k | expand

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(+)
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)