* [PATCH net] tcp_cubic: do not set epoch_start in the future
@ 2015-09-17 15:38 Eric Dumazet
2015-09-18 5:35 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2015-09-17 15:38 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Neal Cardwell, Yuchung Cheng, Jana Iyengar
From: Eric Dumazet <edumazet@google.com>
Tracking idle time in bictcp_cwnd_event() is imprecise, as epoch_start
is normally set at ACK processing time, not at send time.
Doing a proper fix would need to add an additional state variable,
and does not seem worth the trouble, given CUBIC bug has been there
forever before Jana noticed it.
Let's simply not set epoch_start in the future, otherwise
bictcp_update() could overflow and CUBIC would again
grow cwnd too fast.
This was detected thanks to a packetdrill test Neal wrote that was flaky
before applying this fix.
Fixes: 30927520dbae ("tcp_cubic: better follow cubic curve after idle period")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Cc: Jana Iyengar <jri@google.com>
---
net/ipv4/tcp_cubic.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
index c6ded6b2a79f..448c2615fece 100644
--- a/net/ipv4/tcp_cubic.c
+++ b/net/ipv4/tcp_cubic.c
@@ -154,14 +154,20 @@ static void bictcp_init(struct sock *sk)
static void bictcp_cwnd_event(struct sock *sk, enum tcp_ca_event event)
{
if (event == CA_EVENT_TX_START) {
- s32 delta = tcp_time_stamp - tcp_sk(sk)->lsndtime;
struct bictcp *ca = inet_csk_ca(sk);
+ u32 now = tcp_time_stamp;
+ s32 delta;
+
+ delta = now - tcp_sk(sk)->lsndtime;
/* We were application limited (idle) for a while.
* Shift epoch_start to keep cwnd growth to cubic curve.
*/
- if (ca->epoch_start && delta > 0)
+ if (ca->epoch_start && delta > 0) {
ca->epoch_start += delta;
+ if (after(ca->epoch_start, now))
+ ca->epoch_start = now;
+ }
return;
}
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] tcp_cubic: do not set epoch_start in the future
2015-09-17 15:38 [PATCH net] tcp_cubic: do not set epoch_start in the future Eric Dumazet
@ 2015-09-18 5:35 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-09-18 5:35 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, ncardwell, ycheng, jri
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 17 Sep 2015 08:38:00 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> Tracking idle time in bictcp_cwnd_event() is imprecise, as epoch_start
> is normally set at ACK processing time, not at send time.
>
> Doing a proper fix would need to add an additional state variable,
> and does not seem worth the trouble, given CUBIC bug has been there
> forever before Jana noticed it.
>
> Let's simply not set epoch_start in the future, otherwise
> bictcp_update() could overflow and CUBIC would again
> grow cwnd too fast.
>
> This was detected thanks to a packetdrill test Neal wrote that was flaky
> before applying this fix.
>
> Fixes: 30927520dbae ("tcp_cubic: better follow cubic curve after idle period")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> Cc: Jana Iyengar <jri@google.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-18 5:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 15:38 [PATCH net] tcp_cubic: do not set epoch_start in the future Eric Dumazet
2015-09-18 5:35 ` 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).