* [PATCH net-next 0/2] net: netpoll: remove dead code and speed up rtnl-locked region
@ 2025-09-18 12:25 Breno Leitao
2025-09-18 12:25 ` [PATCH net-next 1/2] net: netpoll: remove unused netpoll pointer from netpoll_info Breno Leitao
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Breno Leitao @ 2025-09-18 12:25 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman
Cc: netdev, linux-kernel, Breno Leitao, efault, jv, kernel-team, calvin
This patchset introduces two minor modernizations to the netpoll
infrastructure:
The first patch removes the unused netpoll pointer from the netpoll_info
structure. This member is redundant and its presence does not benefit
multi-instance setups, as reported by Jay Vosburgh. Eliminating it cleans up
the structure and removes unnecessary code.
The second patch updates the netpoll resource cleanup routine to use
synchronize_net() instead of synchronize_rcu(). As __netpoll_free() is always
called under the RTNL lock, using synchronize_net() leverages the more
efficient synchronize_rcu_expedited() in these contexts, reducing time spent in
critical sections and improving performance.
Both changes simplify maintenance and enhance efficiency without altering
netpoll behavior.
This is not expected to conflict with the other netpoll fix into `net`.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (2):
net: netpoll: remove unused netpoll pointer from netpoll_info
net: netpoll: use synchronize_net() instead of synchronize_rcu()
include/linux/netpoll.h | 1 -
net/core/netpoll.c | 3 +--
2 files changed, 1 insertion(+), 3 deletions(-)
---
base-commit: 64d2616972b77506731fa0122d3c48cb04dbe21b
change-id: 20250918-netpoll_jv-9bf6f640f308
Best regards,
--
Breno Leitao <leitao@debian.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] net: netpoll: remove unused netpoll pointer from netpoll_info
2025-09-18 12:25 [PATCH net-next 0/2] net: netpoll: remove dead code and speed up rtnl-locked region Breno Leitao
@ 2025-09-18 12:25 ` Breno Leitao
2025-09-18 12:25 ` [PATCH net-next 2/2] net: netpoll: use synchronize_net() instead of synchronize_rcu() Breno Leitao
2025-09-20 1:00 ` [PATCH net-next 0/2] net: netpoll: remove dead code and speed up rtnl-locked region patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2025-09-18 12:25 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman
Cc: netdev, linux-kernel, Breno Leitao, efault, jv, kernel-team, calvin
The netpoll_info structure contains an useless pointer back to its
associated netpoll. This field is never used, and the assignment in
__netpoll_setup() is does not comtemplate multiple instances, as
reported by Jay[1].
Drop both the member and its initialization to simplify the structure.
Reported-by: Jay Vosburgh <jv@jvosburgh.net>
Closes: https://lore.kernel.org/all/2930648.1757463506@famine/ [1]
Signed-off-by: Breno Leitao <leitao@debian.org>
---
include/linux/netpoll.h | 1 -
net/core/netpoll.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index b5ea9882eda8b..f22eec4660405 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -55,7 +55,6 @@ struct netpoll_info {
struct delayed_work tx_work;
- struct netpoll *netpoll;
struct rcu_head rcu;
};
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 5f65b62346d4e..c58faa7471650 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -591,7 +591,6 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev)
np->dev = ndev;
strscpy(np->dev_name, ndev->name, IFNAMSIZ);
- npinfo->netpoll = np;
/* fill up the skb queue */
refill_skbs(np);
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] net: netpoll: use synchronize_net() instead of synchronize_rcu()
2025-09-18 12:25 [PATCH net-next 0/2] net: netpoll: remove dead code and speed up rtnl-locked region Breno Leitao
2025-09-18 12:25 ` [PATCH net-next 1/2] net: netpoll: remove unused netpoll pointer from netpoll_info Breno Leitao
@ 2025-09-18 12:25 ` Breno Leitao
2025-09-20 1:00 ` [PATCH net-next 0/2] net: netpoll: remove dead code and speed up rtnl-locked region patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2025-09-18 12:25 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman
Cc: netdev, linux-kernel, Breno Leitao, efault, jv, kernel-team, calvin
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>
---
net/core/netpoll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index c58faa7471650..60a05d3b7c249 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -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);
}
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 0/2] net: netpoll: remove dead code and speed up rtnl-locked region
2025-09-18 12:25 [PATCH net-next 0/2] net: netpoll: remove dead code and speed up rtnl-locked region Breno Leitao
2025-09-18 12:25 ` [PATCH net-next 1/2] net: netpoll: remove unused netpoll pointer from netpoll_info Breno Leitao
2025-09-18 12:25 ` [PATCH net-next 2/2] net: netpoll: use synchronize_net() instead of synchronize_rcu() Breno Leitao
@ 2025-09-20 1:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-20 1:00 UTC (permalink / raw)
To: Breno Leitao
Cc: davem, edumazet, kuba, pabeni, horms, netdev, linux-kernel,
efault, jv, kernel-team, calvin
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 18 Sep 2025 05:25:56 -0700 you wrote:
> This patchset introduces two minor modernizations to the netpoll
> infrastructure:
>
> The first patch removes the unused netpoll pointer from the netpoll_info
> structure. This member is redundant and its presence does not benefit
> multi-instance setups, as reported by Jay Vosburgh. Eliminating it cleans up
> the structure and removes unnecessary code.
>
> [...]
Here is the summary with links:
- [net-next,1/2] net: netpoll: remove unused netpoll pointer from netpoll_info
https://git.kernel.org/netdev/net-next/c/b34df17d588d
- [net-next,2/2] net: netpoll: use synchronize_net() instead of synchronize_rcu()
https://git.kernel.org/netdev/net-next/c/614accf54553
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-20 1:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-18 12:25 [PATCH net-next 0/2] net: netpoll: remove dead code and speed up rtnl-locked region Breno Leitao
2025-09-18 12:25 ` [PATCH net-next 1/2] net: netpoll: remove unused netpoll pointer from netpoll_info Breno Leitao
2025-09-18 12:25 ` [PATCH net-next 2/2] net: netpoll: use synchronize_net() instead of synchronize_rcu() Breno Leitao
2025-09-20 1:00 ` [PATCH net-next 0/2] net: netpoll: remove dead code and speed up rtnl-locked region patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®