* [PATCH net] tcp: when rearming RTO, if RTO time is in past then fire RTO ASAP
@ 2017-08-16 21:53 Neal Cardwell
2017-08-17 14:56 ` Neal Cardwell
2017-08-18 23:08 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Neal Cardwell @ 2017-08-16 21:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Neal Cardwell, Yuchung Cheng, Eric Dumazet
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>
---
net/ipv4/tcp_input.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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);
--
2.14.1.480.gb18f417b89-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] tcp: when rearming RTO, if RTO time is in past then fire RTO ASAP
2017-08-16 21:53 [PATCH net] tcp: when rearming RTO, if RTO time is in past then fire RTO ASAP Neal Cardwell
@ 2017-08-17 14:56 ` Neal Cardwell
2017-08-18 23:08 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Neal Cardwell @ 2017-08-17 14:56 UTC (permalink / raw)
To: David Miller; +Cc: Netdev, Neal Cardwell, Yuchung Cheng, Eric Dumazet
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] tcp: when rearming RTO, if RTO time is in past then fire RTO ASAP
2017-08-16 21:53 [PATCH net] tcp: when rearming RTO, if RTO time is in past then fire RTO ASAP Neal Cardwell
2017-08-17 14:56 ` Neal Cardwell
@ 2017-08-18 23:08 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-08-18 23:08 UTC (permalink / raw)
To: ncardwell; +Cc: netdev, ycheng, edumazet
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-18 23:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-16 21:53 [PATCH net] tcp: when rearming RTO, if RTO time is in past then fire RTO ASAP Neal Cardwell
2017-08-17 14:56 ` Neal Cardwell
2017-08-18 23:08 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).