net: give more chances to rcu in netdev_wait_allrefs_any()
Subsystems (2)
PATCH 1/1 net: give more chances to rcu in netdev_wait_allrefs_any()
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.
--- net/core/dev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/dev.c +2 -1
@@ -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);
Signature · 1 line
2.44.0.769.g3c40516874-goog
Quoted 13 lines · Fri, Apr 26, 2024 at 08:42:22AM CEST, [email protected] wrote:
This came while reviewing commit
c4e86b4363ac("net: add two morecall_rcu_hurry()").Paolo asked if adding one
synchronize_rcu()would help.While
synchronize_rcu()does not help, making sure to callrcu_barrier()before msleep(wait) is definitely helping to make sure lazycall_rcu()are completed.Instead of waiting ~100 seconds in my tests, the
ref_trackersplats occurs one time only, andnetdev_wait_allrefs_any()latency is reduced to the strict minimum.
Quoted 7 lines
Ideally we should audit our
call_rcu()users to make sure no refcount (or cascadingcall_rcu()) is held too long, becausercu_barrier()is quite expensive.Fixes 0e4be9e57e8c ("net: use exponential backoff in netdev_wait_allrefs")Signed-off-by Eric Dumazet <[email protected]>
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 10 lines · On Fri, 26 Apr 2024 06:42:22 +0000 you wrote:
This came while reviewing commit
c4e86b4363ac("net: add two morecall_rcu_hurry()").Paolo asked if adding one
synchronize_rcu()would help.While
synchronize_rcu()does not help, making sure to callrcu_barrier()before msleep(wait) is definitely helping to make sure lazycall_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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html