* [PATCH net-next] net: give more chances to rcu in netdev_wait_allrefs_any()
@ 2024-04-26 6:42 Eric Dumazet
2024-04-26 11:34 ` Jiri Pirko
2024-04-29 9:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2024-04-26 6:42 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: netdev, eric.dumazet, Eric Dumazet
This came while reviewing commit c4e86b4363ac ("net: add two more
call_rcu_hurry()").
Paolo asked if adding one synchronize_rcu() would help.
While synchronize_rcu() does not help, making sure to call
rcu_barrier() before msleep(wait) is definitely helping
to make sure lazy call_rcu() are completed.
Instead of waiting ~100 seconds in my tests, the ref_tracker
splats occurs one time only, and netdev_wait_allrefs_any()
latency is reduced to the strict minimum.
Ideally we should audit our call_rcu() users to make sure
no refcount (or cascading call_rcu()) is held too long,
because rcu_barrier() is quite expensive.
Fixes: 0e4be9e57e8c ("net: use exponential backoff in netdev_wait_allrefs")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/all/28bbf698-befb-42f6-b561-851c67f464aa@kernel.org/T/#m76d73ed6b03cd930778ac4d20a777f22a08d6824
---
net/core/dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index e09aa3785c159b4ab0fe7eb3546f9dd6797ebce2..c9e59eff8ec841f6267c2749489fdc7fe0d03430 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -10566,8 +10566,9 @@ static struct net_device *netdev_wait_allrefs_any(struct list_head *list)
rebroadcast_time = jiffies;
}
+ rcu_barrier();
+
if (!wait) {
- rcu_barrier();
wait = WAIT_REFS_MIN_MSECS;
} else {
msleep(wait);
--
2.44.0.769.g3c40516874-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: give more chances to rcu in netdev_wait_allrefs_any()
2024-04-26 6:42 [PATCH net-next] net: give more chances to rcu in netdev_wait_allrefs_any() Eric Dumazet
@ 2024-04-26 11:34 ` Jiri Pirko
2024-04-29 9:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2024-04-26 11:34 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
eric.dumazet
Fri, Apr 26, 2024 at 08:42:22AM CEST, edumazet@google.com wrote:
>This came while reviewing commit c4e86b4363ac ("net: add two more
>call_rcu_hurry()").
>
>Paolo asked if adding one synchronize_rcu() would help.
>
>While synchronize_rcu() does not help, making sure to call
>rcu_barrier() before msleep(wait) is definitely helping
>to make sure lazy call_rcu() are completed.
>
>Instead of waiting ~100 seconds in my tests, the ref_tracker
>splats occurs one time only, and netdev_wait_allrefs_any()
>latency is reduced to the strict minimum.
>
>Ideally we should audit our call_rcu() users to make sure
>no refcount (or cascading call_rcu()) is held too long,
>because rcu_barrier() is quite expensive.
>
>Fixes: 0e4be9e57e8c ("net: use exponential backoff in netdev_wait_allrefs")
>Signed-off-by: Eric Dumazet <edumazet@google.com>
>Link: https://lore.kernel.org/all/28bbf698-befb-42f6-b561-851c67f464aa@kernel.org/T/#m76d73ed6b03cd930778ac4d20a777f22a08d6824
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: give more chances to rcu in netdev_wait_allrefs_any()
2024-04-26 6:42 [PATCH net-next] net: give more chances to rcu in netdev_wait_allrefs_any() Eric Dumazet
2024-04-26 11:34 ` Jiri Pirko
@ 2024-04-29 9:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-29 9:00 UTC (permalink / raw)
To: Eric Dumazet; +Cc: davem, kuba, pabeni, netdev, eric.dumazet
Hello:
This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Fri, 26 Apr 2024 06:42:22 +0000 you wrote:
> This came while reviewing commit c4e86b4363ac ("net: add two more
> call_rcu_hurry()").
>
> Paolo asked if adding one synchronize_rcu() would help.
>
> While synchronize_rcu() does not help, making sure to call
> rcu_barrier() before msleep(wait) is definitely helping
> to make sure lazy call_rcu() are completed.
>
> [...]
Here is the summary with links:
- [net-next] net: give more chances to rcu in netdev_wait_allrefs_any()
https://git.kernel.org/netdev/net-next/c/cd42ba1c8ac9
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] 3+ messages in thread
end of thread, other threads:[~2024-04-29 9:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-26 6:42 [PATCH net-next] net: give more chances to rcu in netdev_wait_allrefs_any() Eric Dumazet
2024-04-26 11:34 ` Jiri Pirko
2024-04-29 9:00 ` 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