aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-08-21 20:38:02 -0400
committerDavid S. Miller <davem@davemloft.net>2015-08-25 14:33:54 -0400
commit43e122b014c955a33220fabbd09c4b5e4f422c3c (patch)
treea5accf2276666812aed04749e3b6f44505a5cbab /net/ipv4/tcp_input.c
parent4ec3b28c2763e11a423d03810ff0be65f02e635e (diff)
tcp: refine pacing rate determination
When TCP pacing was added back in linux-3.12, we chose to apply a fixed ratio of 200 % against current rate, to allow probing for optimal throughput even during slow start phase, where cwnd can be doubled every other gRTT. At Google, we found it was better applying a different ratio while in Congestion Avoidance phase. This ratio was set to 120 %. We've used the normal tcp_in_slow_start() helper for a while, then tuned the condition to select the conservative ratio as soon as cwnd >= ssthresh/2 : - After cwnd reduction, it is safer to ramp up more slowly, as we approach optimal cwnd. - Initial ramp up (ssthresh == INFINITY) still allows doubling cwnd every other RTT. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Neal Cardwell <ncardwell@google.com> Cc: Yuchung Cheng <ycheng@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0abca2841de2..dc08e2352665 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -753,13 +753,29 @@ static void tcp_rtt_estimator(struct sock *sk, long mrtt_us)
753 * TCP pacing, to smooth the burst on large writes when packets 753 * TCP pacing, to smooth the burst on large writes when packets
754 * in flight is significantly lower than cwnd (or rwin) 754 * in flight is significantly lower than cwnd (or rwin)
755 */ 755 */
756int sysctl_tcp_pacing_ss_ratio __read_mostly = 200;
757int sysctl_tcp_pacing_ca_ratio __read_mostly = 120;
758
756static void tcp_update_pacing_rate(struct sock *sk) 759static void tcp_update_pacing_rate(struct sock *sk)
757{ 760{
758 const struct tcp_sock *tp = tcp_sk(sk); 761 const struct tcp_sock *tp = tcp_sk(sk);
759 u64 rate; 762 u64 rate;
760 763
761 /* set sk_pacing_rate to 200 % of current rate (mss * cwnd / srtt) */ 764 /* set sk_pacing_rate to 200 % of current rate (mss * cwnd / srtt) */
762 rate = (u64)tp->mss_cache * 2 * (USEC_PER_SEC << 3); 765 rate = (u64)tp->mss_cache * ((USEC_PER_SEC / 100) << 3);
766
767 /* current rate is (cwnd * mss) / srtt
768 * In Slow Start [1], set sk_pacing_rate to 200 % the current rate.
769 * In Congestion Avoidance phase, set it to 120 % the current rate.
770 *
771 * [1] : Normal Slow Start condition is (tp->snd_cwnd < tp->snd_ssthresh)
772 * If snd_cwnd >= (tp->snd_ssthresh / 2), we are approaching
773 * end of slow start and should slow down.
774 */
775 if (tp->snd_cwnd < tp->snd_ssthresh / 2)
776 rate *= sysctl_tcp_pacing_ss_ratio;
777 else
778 rate *= sysctl_tcp_pacing_ca_ratio;
763 779
764 rate *= max(tp->snd_cwnd, tp->packets_out); 780 rate *= max(tp->snd_cwnd, tp->packets_out);
765 781