Message ID | 20240604140903.31939-3-fw@strlen.de (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: tcp: un-pin tw timer | expand |
On Tue, Jun 4, 2024 at 4:11 PM Florian Westphal <fw@strlen.de> wrote: > > After previous patch, even if timer fires immediately on another CPU, > context that schedules the timer now holds the ehash spinlock, so timer > cannot reap tw socket until ehash lock is released. > > Signed-off-by: Florian Westphal <fw@strlen.de> Reviewed-by: Eric Dumazet <edumazet@google.com>
On 2024-06-04 16:08:48 [+0200], Florian Westphal wrote: > After previous patch, even if timer fires immediately on another CPU, > context that schedules the timer now holds the ehash spinlock, so timer > cannot reap tw socket until ehash lock is released. The two callers of inet_twsk_hashdance_schedule() have the comment: | /* tw_timer is pinned, so we need to make sure BH are disabled | * in following section, otherwise timer handler could run before | * we complete the initialization. | */ This isn't accurate anymore. I would suggest to simply remove the comment. The only reason for local_bh_disable() is (are) the lock(s). > Signed-off-by: Florian Westphal <fw@strlen.de> Sebastian
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 628d33a41ce5..3e89b927ee61 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c @@ -203,7 +203,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, tw->tw_prot = sk->sk_prot_creator; atomic64_set(&tw->tw_cookie, atomic64_read(&sk->sk_cookie)); twsk_net_set(tw, sock_net(sk)); - timer_setup(&tw->tw_timer, tw_timer_handler, TIMER_PINNED); + timer_setup(&tw->tw_timer, tw_timer_handler, 0); /* * Because we use RCU lookups, we should not set tw_refcnt * to a non null value before everything is setup for this
After previous patch, even if timer fires immediately on another CPU, context that schedules the timer now holds the ehash spinlock, so timer cannot reap tw socket until ehash lock is released. Signed-off-by: Florian Westphal <fw@strlen.de> --- no changes. net/ipv4/inet_timewait_sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)