netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] tcp: fix double-counted receiver RTT when leaving receiver fast path
@ 2013-03-04 16:23 Neal Cardwell
  2013-03-04 16:55 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Neal Cardwell @ 2013-03-04 16:23 UTC (permalink / raw)
  To: David Miller; +Cc: edumazet, ycheng, nanditad, netdev, Neal Cardwell

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 */
-- 
1.8.1.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tcp: fix double-counted receiver RTT when leaving receiver fast path
  2013-03-04 16:23 [PATCH net] tcp: fix double-counted receiver RTT when leaving receiver fast path Neal Cardwell
@ 2013-03-04 16:55 ` Eric Dumazet
  2013-03-04 19:16   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2013-03-04 16:55 UTC (permalink / raw)
  To: Neal Cardwell; +Cc: David Miller, edumazet, ycheng, nanditad, netdev

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tcp: fix double-counted receiver RTT when leaving receiver fast path
  2013-03-04 16:55 ` Eric Dumazet
@ 2013-03-04 19:16   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-03-04 19:16 UTC (permalink / raw)
  To: eric.dumazet; +Cc: ncardwell, edumazet, ycheng, nanditad, netdev

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-04 19:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04 16:23 [PATCH net] tcp: fix double-counted receiver RTT when leaving receiver fast path Neal Cardwell
2013-03-04 16:55 ` Eric Dumazet
2013-03-04 19:16   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).