]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: netpoll: use synchronize_net() instead of synchronize_rcu()
authorBreno Leitao <leitao@debian.org>
Thu, 18 Sep 2025 12:25:58 +0000 (05:25 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 20 Sep 2025 00:52:06 +0000 (17:52 -0700)
Replace synchronize_rcu() with synchronize_net() in __netpoll_free().

synchronize_net() is RTNL-aware and will use the more efficient
synchronize_rcu_expedited() when called under RTNL lock, avoiding
the potentially expensive synchronize_rcu() in RTNL critical sections.

Since __netpoll_free() is called with RTNL held (as indicated by
ASSERT_RTNL()), this change improves performance by reducing the
time spent in the RTNL critical section.

Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20250918-netpoll_jv-v1-2-67d50eeb2c26@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/netpoll.c

index c58faa747165066b9424bb28a3165a024ed74df8..60a05d3b7c2491096f79ea6cf82eeef222c3eac2 100644 (file)
@@ -834,7 +834,7 @@ void __netpoll_free(struct netpoll *np)
        ASSERT_RTNL();
 
        /* Wait for transmitting packets to finish before freeing. */
-       synchronize_rcu();
+       synchronize_net();
        __netpoll_cleanup(np);
        kfree(np);
 }