Message ID | 20241025142025.3558051-2-leitao@debian.org (mailing list archive) |
---|---|
State | New |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: netpoll: Improve SKB pool management | expand |
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:
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@debian.org> --- net/core/netpoll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)