Skip to content

Commit ede656e

Browse files
edumazetdavem330
authored andcommitted
tcp_cubic: make Hystart aware of pacing
For years we disabled Hystart ACK train detection at Google because it was fooled by TCP pacing. ACK train detection uses a simple heuristic, detecting if we receive ACK past half the RTT, to exit slow start before hitting the bottleneck and experience massive drops. But pacing by design might delay packets up to RTT/2, so we need to tweak the Hystart logic to be aware of this extra delay. Tested: Added a 100 usec delay at receiver. Before: nstat -n;for f in {1..10}; do ./super_netperf 1 -H lpaa24 -l -4000000; done;nstat|egrep "Hystart" 9117 7057 9553 8300 7030 6849 9533 10126 6876 8473 TcpExtTCPHystartTrainDetect 10 0.0 TcpExtTCPHystartTrainCwnd 1230 0.0 After : nstat -n;for f in {1..10}; do ./super_netperf 1 -H lpaa24 -l -4000000; done;nstat|egrep "Hystart" 9845 10103 10866 11096 11936 11487 11773 12188 11066 11894 TcpExtTCPHystartTrainDetect 10 0.0 TcpExtTCPHystartTrainCwnd 6462 0.0 Disabling Hystart ACK Train detection gives similar numbers echo 2 >/sys/module/tcp_cubic/parameters/hystart_detect nstat -n;for f in {1..10}; do ./super_netperf 1 -H lpaa24 -l -4000000; done;nstat|egrep "Hystart" 11173 10954 12455 10627 11578 11583 11222 10880 10665 11366 Signed-off-by: Eric Dumazet <[email protected]> Acked-by: Neal Cardwell <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 42f3a8a commit ede656e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

net/ipv4/tcp_cubic.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,25 @@ static void hystart_update(struct sock *sk, u32 delay)
376376
{
377377
struct tcp_sock *tp = tcp_sk(sk);
378378
struct bictcp *ca = inet_csk_ca(sk);
379+
u32 threshold;
379380

380381
if (hystart_detect & HYSTART_ACK_TRAIN) {
381382
u32 now = bictcp_clock_us(sk);
382383

383384
/* first detection parameter - ack-train detection */
384385
if ((s32)(now - ca->last_ack) <= hystart_ack_delta_us) {
385386
ca->last_ack = now;
386-
if ((s32)(now - ca->round_start) > ca->delay_min >> 1) {
387+
388+
threshold = ca->delay_min;
389+
/* Hystart ack train triggers if we get ack past
390+
* ca->delay_min/2.
391+
* Pacing might have delayed packets up to RTT/2
392+
* during slow start.
393+
*/
394+
if (sk->sk_pacing_status == SK_PACING_NONE)
395+
threshold >>= 1;
396+
397+
if ((s32)(now - ca->round_start) > threshold) {
387398
ca->found = 1;
388399
NET_INC_STATS(sock_net(sk),
389400
LINUX_MIB_TCPHYSTARTTRAINDETECT);

0 commit comments

Comments
 (0)