diff mbox

[net] tcp: fix double-counted receiver RTT when leaving receiver fast path

Message ID 1362414185-9874-1-git-send-email-ncardwell@google.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Neal Cardwell March 4, 2013, 4:23 p.m. UTC
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.

Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
 net/ipv4/tcp_input.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Eric Dumazet March 4, 2013, 4:55 p.m. UTC | #1
On Mon, 2013-03-04 at 11:23 -0500, Neal Cardwell wrote:
> 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.
> 
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> ---
>  net/ipv4/tcp_input.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index a759e19..0d9bdac 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -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 */

Acked-by: Eric Dumazet <edumazet@google.com>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 4, 2013, 7:16 p.m. UTC | #2
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 04 Mar 2013 08:55:33 -0800

> On Mon, 2013-03-04 at 11:23 -0500, Neal Cardwell wrote:
>> 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.
>> 
>> Signed-off-by: Neal Cardwell <ncardwell@google.com>
 ...
> Acked-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a759e19..0d9bdac 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -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 */