Skip to content

Commit 25c1a9c

Browse files
SUSSdeveloperdavem330
authored andcommitted
tcp_cubic: fix incorrect HyStart round start detection
I noticed that HyStart incorrectly marks the start of rounds, leading to inaccurate measurements of ACK train lengths and resetting the `ca->sample_cnt` variable. This inaccuracy can impact HyStart's functionality in terminating exponential cwnd growth during Slow-Start, potentially degrading TCP performance. The issue arises because the changes introduced in commit 4e1fddc ("tcp_cubic: fix spurious Hystart ACK train detections for not-cwnd-limited flows") moved the caller of the `bictcp_hystart_reset` function inside the `hystart_update` function. This modification added an additional condition for triggering the caller, requiring that (tcp_snd_cwnd(tp) >= hystart_low_window) must also be satisfied before invoking `bictcp_hystart_reset`. This fix ensures that `bictcp_hystart_reset` is correctly called at the start of a new round, regardless of the congestion window size. This is achieved by moving the condition (tcp_snd_cwnd(tp) >= hystart_low_window) from before calling `bictcp_hystart_reset` to after it. I tested with a client and a server connected through two Linux software routers. In this setup, the minimum RTT was 150 ms, the bottleneck bandwidth was 50 Mbps, and the bottleneck buffer size was 1 BDP, calculated as (50M / 1514 / 8) * 0.150 = 619 packets. I conducted the test twice, transferring data from the server to the client for 1.5 seconds. Before the patch was applied, HYSTART-DELAY stopped the exponential growth of cwnd when cwnd = 516, and the bottleneck link was not yet saturated (516 < 619). After the patch was applied, HYSTART-ACK-TRAIN stopped the exponential growth of cwnd when cwnd = 632, and the bottleneck link was saturated (632 > 619). In this test, applying the patch resulted in 300 KB more data delivered. Fixes: 4e1fddc ("tcp_cubic: fix spurious Hystart ACK train detections for not-cwnd-limited flows") Signed-off-by: Mahdi Arghavani <[email protected]> Reviewed-by: Jason Xing <[email protected]> Cc: Neal Cardwell <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Haibo Zhang <[email protected]> Cc: David Eyers <[email protected]> Cc: Abbas Arghavani <[email protected]> Reviewed-by: Neal Cardwell <[email protected]> Tested-by: Neal Cardwell <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4395a44 commit 25c1a9c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

net/ipv4/tcp_cubic.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,10 @@ static void hystart_update(struct sock *sk, u32 delay)
392392
if (after(tp->snd_una, ca->end_seq))
393393
bictcp_hystart_reset(sk);
394394

395+
/* hystart triggers when cwnd is larger than some threshold */
396+
if (tcp_snd_cwnd(tp) < hystart_low_window)
397+
return;
398+
395399
if (hystart_detect & HYSTART_ACK_TRAIN) {
396400
u32 now = bictcp_clock_us(sk);
397401

@@ -467,9 +471,7 @@ __bpf_kfunc static void cubictcp_acked(struct sock *sk, const struct ack_sample
467471
if (ca->delay_min == 0 || ca->delay_min > delay)
468472
ca->delay_min = delay;
469473

470-
/* hystart triggers when cwnd is larger than some threshold */
471-
if (!ca->found && tcp_in_slow_start(tp) && hystart &&
472-
tcp_snd_cwnd(tp) >= hystart_low_window)
474+
if (!ca->found && tcp_in_slow_start(tp) && hystart)
473475
hystart_update(sk, delay);
474476
}
475477

0 commit comments

Comments
 (0)