* [PATCH net-next] tcp: better comments for RTO initiallization
@ 2013-09-03 21:14 Yuchung Cheng
2013-09-03 21:31 ` Neal Cardwell
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yuchung Cheng @ 2013-09-03 21:14 UTC (permalink / raw)
To: davem, ncardwell, edumazet; +Cc: netdev, Yuchung Cheng
Commit 1b7fdd2ab585("tcp: do not use cached RTT for RTT estimation")
removes important comments on how RTO is initialized and updated.
Hopefully this patch puts those information back.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
---
net/ipv4/tcp_metrics.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 273ed73..4a22f3e 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -481,13 +481,27 @@ void tcp_init_metrics(struct sock *sk)
crtt = tcp_metric_get_jiffies(tm, TCP_METRIC_RTT);
rcu_read_unlock();
reset:
+ /* The initial RTT measurement from the SYN/SYN-ACK is not ideal
+ * to seed the RTO for later data packets because SYN packets are
+ * small. Use the per-dst cached values to seed the RTO but keep
+ * the RTT estimator variables intact (e.g., srtt, mdev, rttvar).
+ * Later the RTO will be updated immediately upon obtaining the first
+ * data RTT sample (tcp_rtt_estimator()). Hence the cached RTT only
+ * influences the first RTO but not later RTT estimation.
+ *
+ * But if RTT is not available from the SYN (due to retransmits or
+ * syn cookies) or the cache, force a conservative 3secs timeout.
+ *
+ * A bit of theory. RTT is time passed after "normal" sized packet
+ * is sent until it is ACKed. In normal circumstances sending small
+ * packets force peer to delay ACKs and calculation is correct too.
+ * The algorithm is adaptive and, provided we follow specs, it
+ * NEVER underestimate RTT. BUT! If peer tries to make some clever
+ * tricks sort of "quick acks" for time long enough to decrease RTT
+ * to low value, and then abruptly stops to do it and starts to delay
+ * ACKs, wait for troubles.
+ */
if (crtt > tp->srtt) {
- /* Initial RTT (tp->srtt) from SYN usually don't measure
- * serialization delay on low BW links well so RTO may be
- * under-estimated. Stay conservative and seed RTO with
- * the RTTs from past data exchanges, using the same seeding
- * formula in tcp_rtt_estimator().
- */
inet_csk(sk)->icsk_rto = crtt + max(crtt >> 2, tcp_rto_min(sk));
} else if (tp->srtt == 0) {
/* RFC6298: 5.7 We've failed to get a valid RTT sample from
--
1.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next] tcp: better comments for RTO initiallization
2013-09-03 21:14 [PATCH net-next] tcp: better comments for RTO initiallization Yuchung Cheng
@ 2013-09-03 21:31 ` Neal Cardwell
2013-09-03 21:33 ` Eric Dumazet
2013-09-04 18:42 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Neal Cardwell @ 2013-09-03 21:31 UTC (permalink / raw)
To: Yuchung Cheng; +Cc: David Miller, Eric Dumazet, Netdev
On Tue, Sep 3, 2013 at 5:14 PM, Yuchung Cheng <ycheng@google.com> wrote:
> Commit 1b7fdd2ab585("tcp: do not use cached RTT for RTT estimation")
> removes important comments on how RTO is initialized and updated.
> Hopefully this patch puts those information back.
>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> ---
> net/ipv4/tcp_metrics.c | 26 ++++++++++++++++++++------
> 1 file changed, 20 insertions(+), 6 deletions(-)
Acked-by: Neal Cardwell <ncardwell@google.com>
Thanks, Yuchung!
neal
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net-next] tcp: better comments for RTO initiallization
2013-09-03 21:14 [PATCH net-next] tcp: better comments for RTO initiallization Yuchung Cheng
2013-09-03 21:31 ` Neal Cardwell
@ 2013-09-03 21:33 ` Eric Dumazet
2013-09-04 18:42 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2013-09-03 21:33 UTC (permalink / raw)
To: Yuchung Cheng; +Cc: davem, ncardwell, edumazet, netdev
On Tue, 2013-09-03 at 14:14 -0700, Yuchung Cheng wrote:
> Commit 1b7fdd2ab585("tcp: do not use cached RTT for RTT estimation")
> removes important comments on how RTO is initialized and updated.
> Hopefully this patch puts those information back.
>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> ---
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net-next] tcp: better comments for RTO initiallization
2013-09-03 21:14 [PATCH net-next] tcp: better comments for RTO initiallization Yuchung Cheng
2013-09-03 21:31 ` Neal Cardwell
2013-09-03 21:33 ` Eric Dumazet
@ 2013-09-04 18:42 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-09-04 18:42 UTC (permalink / raw)
To: ycheng; +Cc: ncardwell, edumazet, netdev
From: Yuchung Cheng <ycheng@google.com>
Date: Tue, 3 Sep 2013 14:14:35 -0700
> Commit 1b7fdd2ab585("tcp: do not use cached RTT for RTT estimation")
> removes important comments on how RTO is initialized and updated.
> Hopefully this patch puts those information back.
>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-09-04 18:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-03 21:14 [PATCH net-next] tcp: better comments for RTO initiallization Yuchung Cheng
2013-09-03 21:31 ` Neal Cardwell
2013-09-03 21:33 ` Eric Dumazet
2013-09-04 18:42 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox