* [PATCH net] tcp/dccp: do not block bh too long in inet_twdr_twkill_work()
@ 2015-04-10 11:19 Eric Dumazet
2015-04-10 15:31 ` Eric Dumazet
2015-04-13 1:04 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2015-04-10 11:19 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
I have seen inet_twdr_twkill_work() blocking softirq for
periods up to 1.5 seconds, depending on number of timewait sockets.
This is an unacceptable source of latency.
Note that inet_twdr_do_twkill_work() releases death_lock spinlock
for every tw handled, but does not take care of bh enabling.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv4/inet_timewait_sock.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 6d592f8555fb..9c7f480d6ad8 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -303,11 +303,9 @@ void inet_twdr_twkill_work(struct work_struct *work)
continue;
while (inet_twdr_do_twkill_work(twdr, i) != 0) {
- if (need_resched()) {
- spin_unlock_bh(&twdr->death_lock);
- schedule();
- spin_lock_bh(&twdr->death_lock);
- }
+ spin_unlock_bh(&twdr->death_lock);
+ cond_resched();
+ spin_lock_bh(&twdr->death_lock);
}
twdr->thread_slots &= ~(1 << i);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] tcp/dccp: do not block bh too long in inet_twdr_twkill_work()
2015-04-10 11:19 [PATCH net] tcp/dccp: do not block bh too long in inet_twdr_twkill_work() Eric Dumazet
@ 2015-04-10 15:31 ` Eric Dumazet
2015-04-13 1:04 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2015-04-10 15:31 UTC (permalink / raw)
To: David Miller; +Cc: netdev
On Fri, 2015-04-10 at 04:19 -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> I have seen inet_twdr_twkill_work() blocking softirq for
> periods up to 1.5 seconds, depending on number of timewait sockets.
>
> This is an unacceptable source of latency.
>
> Note that inet_twdr_do_twkill_work() releases death_lock spinlock
> for every tw handled, but does not take care of bh enabling.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
BTW, inet_twdr_twcal_tick() suffers from similar problem, with latencies
of ~25ms, when /proc/sys/net/ipv4/tcp_tw_recycle is enabled.
Since it holds death_lock for the whole run, all other cpus are spinning
on it.
I believe we simply should add a timer per timewait, as I did for
request sockets.
This would simplify the code a lot, and would get rid of this awful non
scalable timer wheel.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] tcp/dccp: do not block bh too long in inet_twdr_twkill_work()
2015-04-10 11:19 [PATCH net] tcp/dccp: do not block bh too long in inet_twdr_twkill_work() Eric Dumazet
2015-04-10 15:31 ` Eric Dumazet
@ 2015-04-13 1:04 ` David Miller
2015-04-13 1:52 ` Eric Dumazet
1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2015-04-13 1:04 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 10 Apr 2015 04:19:07 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> I have seen inet_twdr_twkill_work() blocking softirq for
> periods up to 1.5 seconds, depending on number of timewait sockets.
>
> This is an unacceptable source of latency.
>
> Note that inet_twdr_do_twkill_work() releases death_lock spinlock
> for every tw handled, but does not take care of bh enabling.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
I think it makes sense to use local_softirq_pending() here rather
than flip the lock unconditionally.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] tcp/dccp: do not block bh too long in inet_twdr_twkill_work()
2015-04-13 1:04 ` David Miller
@ 2015-04-13 1:52 ` Eric Dumazet
2015-04-13 3:01 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2015-04-13 1:52 UTC (permalink / raw)
To: David Miller; +Cc: netdev
On Sun, 2015-04-12 at 21:04 -0400, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Fri, 10 Apr 2015 04:19:07 -0700
>
> > From: Eric Dumazet <edumazet@google.com>
> >
> > I have seen inet_twdr_twkill_work() blocking softirq for
> > periods up to 1.5 seconds, depending on number of timewait sockets.
> >
> > This is an unacceptable source of latency.
> >
> > Note that inet_twdr_do_twkill_work() releases death_lock spinlock
> > for every tw handled, but does not take care of bh enabling.
> >
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> I think it makes sense to use local_softirq_pending() here rather
> than flip the lock unconditionally.
I thought about that, but this meant having to test 2 conditions.
Not sure we need this patch anyway, if we merge the 'tcp/dccp: get rid
of central timewait timer' in 4.1
Its not like it is a new bug ...
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 6d592f8555fb..942b582d044e 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -303,9 +303,10 @@ void inet_twdr_twkill_work(struct work_struct *work)
continue;
while (inet_twdr_do_twkill_work(twdr, i) != 0) {
- if (need_resched()) {
+ if (local_softirq_pending() ||
+ need_resched()) {
spin_unlock_bh(&twdr->death_lock);
- schedule();
+ cond_resched();
spin_lock_bh(&twdr->death_lock);
}
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] tcp/dccp: do not block bh too long in inet_twdr_twkill_work()
2015-04-13 1:52 ` Eric Dumazet
@ 2015-04-13 3:01 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-04-13 3:01 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 12 Apr 2015 18:52:37 -0700
> On Sun, 2015-04-12 at 21:04 -0400, David Miller wrote:
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> Date: Fri, 10 Apr 2015 04:19:07 -0700
>>
>> > From: Eric Dumazet <edumazet@google.com>
>> >
>> > I have seen inet_twdr_twkill_work() blocking softirq for
>> > periods up to 1.5 seconds, depending on number of timewait sockets.
>> >
>> > This is an unacceptable source of latency.
>> >
>> > Note that inet_twdr_do_twkill_work() releases death_lock spinlock
>> > for every tw handled, but does not take care of bh enabling.
>> >
>> > Signed-off-by: Eric Dumazet <edumazet@google.com>
>>
>> I think it makes sense to use local_softirq_pending() here rather
>> than flip the lock unconditionally.
>
> I thought about that, but this meant having to test 2 conditions.
>
> Not sure we need this patch anyway, if we merge the 'tcp/dccp: get rid
> of central timewait timer' in 4.1
>
> Its not like it is a new bug ...
Yeah, since 4.0 is out already, probably just pass on this patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-13 3:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-10 11:19 [PATCH net] tcp/dccp: do not block bh too long in inet_twdr_twkill_work() Eric Dumazet
2015-04-10 15:31 ` Eric Dumazet
2015-04-13 1:04 ` David Miller
2015-04-13 1:52 ` Eric Dumazet
2015-04-13 3:01 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.