[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241025142025.3558051-2-leitao@debian.org>
Date: Fri, 25 Oct 2024 07:20:18 -0700
From: Breno Leitao <leitao@...ian.org>
To: kuba@...nel.org,
horms@...nel.org,
davem@...emloft.net,
edumazet@...gle.com,
pabeni@...hat.com
Cc: thepacketgeek@...il.com,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
davej@...emonkey.org.uk,
vlad.wing@...il.com,
max@...sevol.com,
kernel-team@...a.com,
jiri@...nulli.us,
jv@...sburgh.net,
andy@...yhouse.net,
aehkn@...hub.one,
Rik van Riel <riel@...riel.com>,
Al Viro <viro@...iv.linux.org.uk>
Subject: [PATCH net-next 1/3] net: netpoll: Defer skb_pool population until setup success
The current implementation has a flaw where it populates the skb_pool
with 32 SKBs before calling __netpoll_setup(). If the setup fails, the
skb_pool buffer will persist indefinitely and never be cleaned up.
This change moves the skb_pool population to after the successful
completion of __netpoll_setup(), ensuring that the buffers are not
unnecessarily retained. Additionally, this modification alleviates rtnl
lock pressure by allowing the buffer filling to occur outside of the
lock.
Signed-off-by: Breno Leitao <leitao@...ian.org>
---
net/core/netpoll.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index aa49b92e9194..e83fd8bdce36 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -772,13 +772,13 @@ int netpoll_setup(struct netpoll *np)
}
}
- /* fill up the skb queue */
- refill_skbs();
-
err = __netpoll_setup(np, ndev);
if (err)
goto put;
rtnl_unlock();
+
+ /* fill up the skb queue */
+ refill_skbs();
return 0;
put:
--
2.43.5
Powered by blists - more mailing lists