Message ID | 20170816215336.30419-1-ncardwell@google.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On Wed, Aug 16, 2017 at 5:53 PM, Neal Cardwell <ncardwell@google.com> wrote: > In some situations tcp_send_loss_probe() can realize that it's unable > to send a loss probe (TLP), and falls back to calling tcp_rearm_rto() > to schedule an RTO timer. In such cases, sometimes tcp_rearm_rto() > realizes that the RTO was eligible to fire immediately or at some > point in the past (delta_us <= 0). Previously in such cases > tcp_rearm_rto() was scheduling such "overdue" RTOs to happen at now + > icsk_rto, which caused needless delays of hundreds of milliseconds > (and non-linear behavior that made reproducible testing > difficult). This commit changes the logic to schedule "overdue" RTOs > ASAP, rather than at now + icsk_rto. > > Suggested-by: Yuchung Cheng <ycheng@google.com> > Signed-off-by: Neal Cardwell <ncardwell@google.com> > Signed-off-by: Yuchung Cheng <ycheng@google.com> > Signed-off-by: Eric Dumazet <edumazet@google.com> > --- Forgot to mention: Fixes: 6ba8a3b19e76 ("tcp: Tail loss probe (TLP)") This is a -stable candidate. thanks, neal
From: Neal Cardwell <ncardwell@google.com> Date: Wed, 16 Aug 2017 17:53:36 -0400 > In some situations tcp_send_loss_probe() can realize that it's unable > to send a loss probe (TLP), and falls back to calling tcp_rearm_rto() > to schedule an RTO timer. In such cases, sometimes tcp_rearm_rto() > realizes that the RTO was eligible to fire immediately or at some > point in the past (delta_us <= 0). Previously in such cases > tcp_rearm_rto() was scheduling such "overdue" RTOs to happen at now + > icsk_rto, which caused needless delays of hundreds of milliseconds > (and non-linear behavior that made reproducible testing > difficult). This commit changes the logic to schedule "overdue" RTOs > ASAP, rather than at now + icsk_rto. > > Suggested-by: Yuchung Cheng <ycheng@google.com> > Signed-off-by: Neal Cardwell <ncardwell@google.com> > Signed-off-by: Yuchung Cheng <ycheng@google.com> > Signed-off-by: Eric Dumazet <edumazet@google.com> Applied with Fixes: tag added and queued up for -stable, thanks Neal.
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 53de1424c13c..bab7f0493098 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3009,8 +3009,7 @@ void tcp_rearm_rto(struct sock *sk) /* delta_us may not be positive if the socket is locked * when the retrans timer fires and is rescheduled. */ - if (delta_us > 0) - rto = usecs_to_jiffies(delta_us); + rto = usecs_to_jiffies(max_t(int, delta_us, 1)); } inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, rto, TCP_RTO_MAX);