tcp: fix double-counted receiver RTT when leaving receiver fast path
Subsystems (3)
Neal Cardwell
maintainerPATCH 1/1 tcp: fix double-counted receiver RTT when leaving receiver fast path
We should not update ts_recent and call tcp_rcv_rtt_measure_ts() both before and after going to step5. That wastes CPU and double-counts the receiver-side RTT sample.
--- net/ipv4/tcp_input.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv4/tcp_input.c +3 -3
@@ -5485,6 +5485,9 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,if (tcp_checksum_complete_user (sk, skb)) goto csum_error; +if ((int )skb->truesize > sk->sk_forward_alloc) + goto step5; +/* Predicted packet is in window by definition. * seq == rcv_nxt and rcv_wup <= rcv_nxt. * Hence, check seq<=rcv_wup reduces to:
@@ -5496,9 +5499,6 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,tcp_rcv_rtt_measure_ts (sk, skb); -if ((int )skb->truesize > sk->sk_forward_alloc) - goto step5; -NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_TCPHPHITS );/* Bulk data transfer: receiver */
Signature · 1 line
1.8.1.3
Quoted 24 lines · Neal Cardwell
We should not update
ts_recentand calltcp_rcv_rtt_measure_ts()both before and after going to step5. That wastes CPU and double-counts the receiver-side RTT sample.Signed-off-by Neal Cardwell <[email protected]>--- net/ipv4/tcp_input.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)net/ipv4/tcp_input.c +3
-0@@ -5485,6 +5485,9 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,if (tcp_checksum_complete_user (sk, skb)) goto csum_error; +if ((int )skb->truesize > sk->sk_forward_alloc) + goto step5; +/* Predicted packet is in window by definition. * seq == rcv_nxt and rcv_wup <= rcv_nxt. * Hence, check seq<=rcv_wup reduces to:
net/ipv4/tcp_input.c int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, · line 5504
Quoted 9 lines
net/ipv4/tcp_input.c +0
-3@@ -5496,9 +5499,6 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,tcp_rcv_rtt_measure_ts (sk, skb); -if ((int )skb->truesize > sk->sk_forward_alloc) - goto step5; -NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_TCPHPHITS );/* Bulk data transfer: receiver */
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Mon, 04 Mar 2013 08:55:33 -0800
Quoted 6 lines · Neal Cardwell
Quoted 5 lines
We should not update
ts_recentand calltcp_rcv_rtt_measure_ts()both before and after going to step5. That wastes CPU and double-counts the receiver-side RTT sample.Signed-off-by Neal Cardwell <[email protected]>
...
Quoted 1 line
Acked-by Eric Dumazet <[email protected]>
Applied and queued up for -stable.