aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2018-10-15 12:37:52 -0400
committerDavid S. Miller <davem@davemloft.net>2018-10-16 01:56:41 -0400
commit5f6188a8003d080e3753b8f14f4a5a2325ae1ff6 (patch)
tree17f35c12eeef92a69902b197a73c1123eaac9e63 /net/ipv4/tcp_output.c
parent1a3aea2534f4f3083f29b2b047aa83a9d6c777a4 (diff)
tcp: do not change tcp_wstamp_ns in tcp_mstamp_refresh
In EDT design, I made the mistake of using tcp_wstamp_ns to store the last tcp_clock_ns() sample and to store the pacing virtual timer. This causes major regressions at high speed flows. Introduce tcp_clock_cache to store last tcp_clock_ns(). This is needed because some arches have slow high-resolution kernel time service. tcp_wstamp_ns is only updated when a packet is sent. Note that we can remove tcp_mstamp in the future since tcp_mstamp is essentially tcp_clock_cache/1000, so the apparent socket size increase is temporary. Fixes: 9799ccb0e984 ("tcp: add tcp_wstamp_ns socket field") Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 059b67af28b1..f14df66a0c85 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -52,9 +52,8 @@ void tcp_mstamp_refresh(struct tcp_sock *tp)
52{ 52{
53 u64 val = tcp_clock_ns(); 53 u64 val = tcp_clock_ns();
54 54
55 /* departure time for next data packet */ 55 if (val > tp->tcp_clock_cache)
56 if (val > tp->tcp_wstamp_ns) 56 tp->tcp_clock_cache = val;
57 tp->tcp_wstamp_ns = val;
58 57
59 val = div_u64(val, NSEC_PER_USEC); 58 val = div_u64(val, NSEC_PER_USEC);
60 if (val > tp->tcp_mstamp) 59 if (val > tp->tcp_mstamp)
@@ -1050,6 +1049,10 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
1050 if (unlikely(!skb)) 1049 if (unlikely(!skb))
1051 return -ENOBUFS; 1050 return -ENOBUFS;
1052 } 1051 }
1052
1053 /* TODO: might take care of jitter here */
1054 tp->tcp_wstamp_ns = max(tp->tcp_wstamp_ns, tp->tcp_clock_cache);
1055
1053 skb->skb_mstamp_ns = tp->tcp_wstamp_ns; 1056 skb->skb_mstamp_ns = tp->tcp_wstamp_ns;
1054 1057
1055 inet = inet_sk(sk); 1058 inet = inet_sk(sk);