[Devel] [PATCH RH9 03/30] net/mlx5: suppress high order allocation

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Tue Sep 28 21:48:54 MSK 2021


From: Vasily Averin <vvs at virtuozzo.com>

v2: added lost kvfree()

WARNING: CPU: 0 PID: 9668 at mm/page_alloc.c:3548 __alloc_pages_nodemask+0x1b1/0x600
order 4 >= 3, gfp 0xc0d0
CPU: 0 PID: 9668 Comm: ip ve: 0 Not tainted 3.10.0-1127.8.2.vz7.158.3 #1 158.3
Call Trace:
 [<ffffffff909b67f1>] dump_stack+0x19/0x1b
 [<ffffffff9029d168>] __warn+0xd8/0x100
 [<ffffffff9029d1ef>] warn_slowpath_fmt+0x5f/0x80
 [<ffffffff903de901>] __alloc_pages_nodemask+0x1b1/0x600
 [<ffffffff90434568>] alloc_pages_current+0x98/0x110
 [<ffffffff903fdf48>] kmalloc_order+0x18/0x40
 [<ffffffff903fdf96>] kmalloc_order_trace+0x26/0xa0
 [<ffffffff90444421>] __kmalloc+0x281/0x2a0
 [<ffffffffc02a6aa1>] mlx5_frag_buf_alloc_node+0x61/0x320 [mlx5_core]
 [<ffffffffc02b92ca>] mlx5_cqwq_create+0xaa/0x1c0 [mlx5_core]
 [<ffffffffc02beeba>] mlx5e_alloc_cq_common+0x7a/0x130 [mlx5_core]
 [<ffffffffc02c1f71>] mlx5e_open_cq.isra.50+0x81/0x100 [mlx5_core]
 [<ffffffffc02c38ee>] mlx5e_open_channels+0x49e/0xd60 [mlx5_core]
 [<ffffffffc02c58dd>] mlx5e_open_locked+0x2d/0xb0 [mlx5_core]
 [<ffffffffc02c5988>] mlx5e_open+0x28/0xb0 [mlx5_core]
 [<ffffffff9088cb12>] __dev_open+0xd2/0x150
 [<ffffffff9088ce43>] __dev_change_flags+0xa3/0x180
 [<ffffffff9088cf49>] dev_change_flags+0x29/0x60
 [<ffffffff908a0655>] do_setlink+0x385/0xe50
 [<ffffffff908a1e02>] rtnl_newlink+0x532/0x890
 [<ffffffff908a2225>] rtnetlink_rcv_msg+0xc5/0x280
 [<ffffffff908c623b>] netlink_rcv_skb+0xab/0xc0
 [<ffffffff9089c528>] rtnetlink_rcv+0x28/0x30
 [<ffffffff908c5b9c>] netlink_unicast+0x1bc/0x240
 [<ffffffff908c5f6e>] netlink_sendmsg+0x34e/0x460
 [<ffffffff908674c0>] sock_sendmsg+0xb0/0xf0
 [<ffffffff908683b9>] ___sys_sendmsg+0x3e9/0x400
 [<ffffffff90869a41>] __sys_sendmsg+0x51/0x90
 [<ffffffff90869a92>] SyS_sendmsg+0x12/0x20
 [<ffffffff909c9fd2>] system_call_fastpath+0x25/0x2a

https://pmc.acronis.com/browse/VSTOR-35452
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>

(cherry picked from vz8 commit 303ce3c19b9e669d8b466f94bbb684a1681287b8)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/alloc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
index 291e427..ed4fd4c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c
@@ -126,8 +126,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 = kvcalloc(buf->npages, sizeof(struct mlx5_buf_list),
+			      GFP_KERNEL);
 	if (!buf->frags)
 		goto err_out;
 
@@ -155,7 +155,7 @@ int mlx5_frag_buf_alloc_node(struct mlx5_core_dev *dev, int size,
 	while (i--)
 		dma_free_coherent(mlx5_core_dma_dev(dev), PAGE_SIZE, buf->frags[i].buf,
 				  buf->frags[i].map);
-	kfree(buf->frags);
+	kvfree(buf->frags);
 err_out:
 	return -ENOMEM;
 }
@@ -173,7 +173,7 @@ void mlx5_frag_buf_free(struct mlx5_core_dev *dev, struct mlx5_frag_buf *buf)
 				  buf->frags[i].map);
 		size -= frag_sz;
 	}
-	kfree(buf->frags);
+	kvfree(buf->frags);
 }
 EXPORT_SYMBOL_GPL(mlx5_frag_buf_free);
 
-- 
1.8.3.1



More information about the Devel mailing list