History

tcp: allow at most one TLP probe per flight

Previously TLP may send multiple probes of new data in one flight. This happens when the sender is cwnd limited. After the initial TLP containing new data is sent, the sender receives another ACK that acks partial inflight. It may re-arm another TLP timer to send more, if no further ACK returns before the next TLP timeout (PTO) expires. The sender may send in theory a large amount of TLP until send queue is depleted. This only happens if the sender sees such irregular uncommon ACK pattern. But it is generally undesirable behavior during congestion especially. The original TLP design restrict only one TLP probe per inflight as published in "Reducing Web Latency: the Virtue of Gentle Aggression", SIGCOMM 2013. This patch changes TLP to send at most one probe per inflight. Note that if the sender is app-limited, TLP retransmits old data and did not have this issue.

Yuchung Cheng committed 6 years ago

Commit 76be93f1 parent 17ad73e3 files · +18 −12Browse files

Unified · Split

3 files
  1. include/linux/tcp.h +4 −2
  2. net/ipv4/tcp_input.c +6 −5
  3. net/ipv4/tcp_output.c +8 −5
include/linux/tcp.h+4−2
@@ -220,7 +220,9 @@ struct tcp_sock { · 219 unmodified lines
220 } rack;220 } rack;
221 u16 advmss; /* Advertised MSS */221 u16 advmss; /* Advertised MSS */
222 u8 compressed_ack;222 u8 compressed_ack;
223 u8 dup_ack_counter;223 u8 dup_ack_counter:2,
224 tlp_retrans:1, /* TLP is a retransmission */
225 unused:5;
224 u32 chrono_start; /* Start time in jiffies of a TCP chrono */226 u32 chrono_start; /* Start time in jiffies of a TCP chrono */
225 u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */227 u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */
226 u8 chrono_type:2, /* current chronograph type */228 u8 chrono_type:2, /* current chronograph type */
@@ -243,7 +245,7 @@ struct tcp_sock { · 16 unmodified lines
243 save_syn:1, /* Save headers of SYN packet */245 save_syn:1, /* Save headers of SYN packet */
244 is_cwnd_limited:1,/* forward progress limited by snd_cwnd? */246 is_cwnd_limited:1,/* forward progress limited by snd_cwnd? */
245 syn_smc:1; /* SYN includes SMC */247 syn_smc:1; /* SYN includes SMC */
246 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */248 u32 tlp_high_seq; /* snd_nxt at the time of TLP */
247 249
248 u32 tcp_tx_delay; /* delay (in usec) added to TX packets */250 u32 tcp_tx_delay; /* delay (in usec) added to TX packets */
249 u64 tcp_wstamp_ns; /* departure time for next sent data packet */251 u64 tcp_wstamp_ns; /* departure time for next sent data packet */
net/ipv4/tcp_input.c+6−5
@@ -3488,10 +3488,8 @@ static void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) · 3487 unmodified lines
3488 }3488 }
3489}3489}
3490 3490
3491/* This routine deals with acks during a TLP episode.3491/* This routine deals with acks during a TLP episode and ends an episode by
3492 * We mark the end of a TLP episode on receiving TLP dupack or when3492 * resetting tlp_high_seq. Ref: TLP algorithm in draft-ietf-tcpm-rack
3493 * ack is after tlp_high_seq.
3494 * Ref: loss detection algorithm in draft-dukkipati-tcpm-tcp-loss-probe.
3495 */3493 */
3496static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag)3494static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag)
3497{3495{
@@ -3500,7 +3498,10 @@ static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag) · 2 unmodified lines
3500 if (before(ack, tp->tlp_high_seq))3498 if (before(ack, tp->tlp_high_seq))
3501 return;3499 return;
3502 3500
3503 if (flag & FLAG_DSACKING_ACK) {3501 if (!tp->tlp_retrans) {
3502 /* TLP of new data has been acknowledged */
3503 tp->tlp_high_seq = 0;
3504 } else if (flag & FLAG_DSACKING_ACK) {
3504 /* This DSACK means original and TLP probe arrived; no loss */3505 /* This DSACK means original and TLP probe arrived; no loss */
3505 tp->tlp_high_seq = 0;3506 tp->tlp_high_seq = 0;
3506 } else if (after(ack, tp->tlp_high_seq)) {3507 } else if (after(ack, tp->tlp_high_seq)) {
net/ipv4/tcp_output.c+8−5
@@ -2624,6 +2624,11 @@ void tcp_send_loss_probe(struct sock *sk) · 2623 unmodified lines
2624 int pcount;2624 int pcount;
2625 int mss = tcp_current_mss(sk);2625 int mss = tcp_current_mss(sk);
2626 2626
2627 /* At most one outstanding TLP */
2628 if (tp->tlp_high_seq)
2629 goto rearm_timer;
2630
2631 tp->tlp_retrans = 0;
2627 skb = tcp_send_head(sk);2632 skb = tcp_send_head(sk);
2628 if (skb && tcp_snd_wnd_test(tp, skb, mss)) {2633 if (skb && tcp_snd_wnd_test(tp, skb, mss)) {
2629 pcount = tp->packets_out;2634 pcount = tp->packets_out;
@@ -2641,10 +2646,6 @@ void tcp_send_loss_probe(struct sock *sk) · 11 unmodified lines
2641 return;2646 return;
2642 }2647 }
2643 2648
2644 /* At most one outstanding TLP retransmission. */
2645 if (tp->tlp_high_seq)
2646 goto rearm_timer;
2647
2648 if (skb_still_in_host_queue(sk, skb))2649 if (skb_still_in_host_queue(sk, skb))
2649 goto rearm_timer;2650 goto rearm_timer;
2650 2651
@@ -2666,10 +2667,12 @@ void tcp_send_loss_probe(struct sock *sk) · 15 unmodified lines
2666 if (__tcp_retransmit_skb(sk, skb, 1))2667 if (__tcp_retransmit_skb(sk, skb, 1))
2667 goto rearm_timer;2668 goto rearm_timer;
2668 2669
2670 tp->tlp_retrans = 1;
2671
2672probe_sent:
2669 /* Record snd_nxt for loss detection. */2673 /* Record snd_nxt for loss detection. */
2670 tp->tlp_high_seq = tp->snd_nxt;2674 tp->tlp_high_seq = tp->snd_nxt;
2671 2675
2672probe_sent:
2673 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSSPROBES);2676 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSSPROBES);
2674 /* Reset s.t. tcp_rearm_rto will restart timer from now */2677 /* Reset s.t. tcp_rearm_rto will restart timer from now */
2675 inet_csk(sk)->icsk_pending = 0;2678 inet_csk(sk)->icsk_pending = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t