Skip to contentSkip to conversation

tcp: only postpone PROBE_RTT if RTT is < current min_rtt estimate

PATCH Applied Ryan Sharpelletti 3 participants 3 messages Nov 16, 2020 – Nov 17, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcp: only postpone PROBE_RTT if RTT is < current min_rtt estimate

From: Ryan Sharpelletti <[email protected]>

During loss recovery, retransmitted packets are forced to use TCP timestamps to calculate the RTT samples, which have a millisecond granularity. BBR is designed using a microsecond granularity. As a result, multiple RTT samples could be truncated to the same RTT value during loss recovery. This is problematic, as BBR will not enter PROBE_RTT if the RTT sample is <= the current min_rtt sample, meaning that if there are persistent losses, PROBE_RTT will constantly be pushed off and potentially never re-entered. This patch makes sure that BBR enters PROBE_RTT by checking if RTT sample is < the current min_rtt sample, rather than <=.

The Netflix transport/TCP team discovered this bug in the Linux TCP BBR code during lab tests.

Fixes 0f8782ea1497 ("tcp_bbr: add BBR congestion control")
---
 net/ipv4/tcp_bbr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_bbr.c +1 -1
index 6c4d79baff26..6ea3dc2e4219 100644
@@ -945,7 +945,7 @@ static void bbr_update_min_rtt(struct sock *sk, const struct rate_sample *rs)
 	filter_expired = after(tcp_jiffies32,
 			       bbr->min_rtt_stamp + bbr_min_rtt_win_sec * HZ);
 	if (rs->rtt_us >= 0 &&
-	    (rs->rtt_us <= bbr->min_rtt_us ||
+	    (rs->rtt_us < bbr->min_rtt_us ||
 	     (filter_expired && !rs->is_ack_delayed))) {
 		bbr->min_rtt_us = rs->rtt_us;
 		bbr->min_rtt_stamp = tcp_jiffies32;
Signature · 1 line
2.29.2.299.gdc1121823c-goog
#1 lore raw

LGTM. Thanks!

Quoted 42 lines · Ryan Sharpelletti

From: Ryan Sharpelletti <[email protected]>

During loss recovery, retransmitted packets are forced to use TCP timestamps to calculate the RTT samples, which have a millisecond granularity. BBR is designed using a microsecond granularity. As a result, multiple RTT samples could be truncated to the same RTT value during loss recovery. This is problematic, as BBR will not enter PROBE_RTT if the RTT sample is <= the current min_rtt sample, meaning that if there are persistent losses, PROBE_RTT will constantly be pushed off and potentially never re-entered. This patch makes sure that BBR enters PROBE_RTT by checking if RTT sample is < the current min_rtt sample, rather than <=.

The Netflix transport/TCP team discovered this bug in the Linux TCP BBR code during lab tests.

Fixes 0f8782ea1497 ("tcp_bbr: add BBR congestion control")
---
 net/ipv4/tcp_bbr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_bbr.c +1 -2
index 6c4d79baff26..6ea3dc2e4219 100644
@@ -945,7 +945,7 @@ static void bbr_update_min_rtt(struct sock *sk, const struct rate_sample *rs)
        filter_expired = after(tcp_jiffies32,
                               bbr->min_rtt_stamp + bbr_min_rtt_win_sec * HZ);
        if (rs->rtt_us >= 0 &&
-           (rs->rtt_us <= bbr->min_rtt_us ||
+           (rs->rtt_us < bbr->min_rtt_us ||
             (filter_expired && !rs->is_ack_delayed))) {
                bbr->min_rtt_us = rs->rtt_us;
                bbr->min_rtt_stamp = tcp_jiffies32;
--

2.29.2.299.gdc1121823c-goog

#2 lore raw
In reply to Ryan Sharpelletti
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 13 lines · On Mon, 16 Nov 2020 17:44:13 +0000 you wrote:

From: Ryan Sharpelletti <[email protected]>

During loss recovery, retransmitted packets are forced to use TCP timestamps to calculate the RTT samples, which have a millisecond granularity. BBR is designed using a microsecond granularity. As a result, multiple RTT samples could be truncated to the same RTT value during loss recovery. This is problematic, as BBR will not enter PROBE_RTT if the RTT sample is <= the current min_rtt sample, meaning that if there are persistent losses, PROBE_RTT will constantly be pushed off and potentially never re-entered. This patch makes sure that BBR enters PROBE_RTT by checking if RTT sample is < the current min_rtt sample, rather than <=.

Quoted 1 line

[...]

Here is the summary with links:
- [net] tcp: only postpone PROBE_RTT if RTT is < current min_rtt estimate

    https://git.kernel.org/netdev/net/c/1b9e2a8c99a5

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html