Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Cc: "Neal Cardwell" <ncardwell@google.com>,
	"Pasi Kärkkäinen" <pasik@iki.fi>,
	"David Miller" <davem@davemloft.net>,
	"Hannes Frederic Sowa" <hannes@stressinduktion.org>,
	"Stephen Hemminger" <stephen@networkplumber.org>,
	Netdev <netdev@vger.kernel.org>,
	"Yuchung Cheng" <ycheng@google.com>
Subject: Re: [PATCH] tcp: frto should not set snd_cwnd to 0
Date: Mon, 04 Feb 2013 07:07:41 -0800	[thread overview]
Message-ID: <1359990461.30177.142.camel@edumazet-glaptop> (raw)
In-Reply-To: <alpine.DEB.2.00.1302041327210.4561@wel-95.cs.helsinki.fi>

On Mon, 2013-02-04 at 14:14 +0200, Ilpo Järvinen wrote:
> On Sun, 3 Feb 2013, Eric Dumazet wrote:
> 
> > From: Eric Dumazet <edumazet@google.com>
> > 
> > Commit 9dc274151a548 (tcp: fix ABC in tcp_slow_start())
> > uncovered a bug in FRTO code :
> > tcp_process_frto() is setting snd_cwnd to 0 if the number
> > of in flight packets is 0.
> > 
> > As Neal pointed out, if no packet is in flight we lost our
> > chance to disambiguate whether a loss timeout was spurious.
> > 
> > We should assume it was a proper loss.
> > 
> > Reported-by: Pasi Kärkkäinen <pasik@iki.fi>
> > Signed-off-by: Neal Cardwell <ncardwell@google.com>
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > Cc: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> > Cc: Yuchung Cheng <ycheng@google.com>
> > ---
> >  net/ipv4/tcp_input.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> > index 8aca4ee..680c422 100644
> > --- a/net/ipv4/tcp_input.c
> > +++ b/net/ipv4/tcp_input.c
> > @@ -3484,7 +3484,8 @@ static bool tcp_process_frto(struct sock *sk, int flag)
> >  	    ((tp->frto_counter >= 2) && (flag & FLAG_RETRANS_DATA_ACKED)))
> >  		tp->undo_marker = 0;
> >  
> > -	if (!before(tp->snd_una, tp->frto_highmark)) {
> > +	if (!before(tp->snd_una, tp->frto_highmark) ||
> > +	    !tcp_packets_in_flight(tp)) {
> 
> I think this condition becomes now too broad because there is transient
> during FRTO. I think the patch below would be enough to resolve this,
> what do you think?
> 
> --
> [PATCH 1/1] tcp: fix for zero packets_in_flight was too broad
> 
> There are transients during normal FRTO procedure during which
> the packets_in_flight can go to zero between write_queue state
> updates and firing the resulting segments out. As FRTO processing
> occurs during that window the check must be more precise to
> not match "spuriously" :-). More specificly, e.g., when
> packets_in_flight is zero but FLAG_DATA_ACKED is true the problematic
> branch that set cwnd into zero would not be taken and new segments
> might be sent out later.
> 
> Only compile tested.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> Cc: Neal Cardwell <ncardwell@google.com>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Pasi Kärkkäinen <pasik@iki.fi>
> ---
>  net/ipv4/tcp_input.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 680c422..500c2da 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -3484,8 +3484,7 @@ static bool tcp_process_frto(struct sock *sk, int flag)
>  	    ((tp->frto_counter >= 2) && (flag & FLAG_RETRANS_DATA_ACKED)))
>  		tp->undo_marker = 0;
>  
> -	if (!before(tp->snd_una, tp->frto_highmark) ||
> -	    !tcp_packets_in_flight(tp)) {
> +	if (!before(tp->snd_una, tp->frto_highmark)) {
>  		tcp_enter_frto_loss(sk, (tp->frto_counter == 1 ? 2 : 3), flag);
>  		return true;
>  	}
> @@ -3505,6 +3504,11 @@ static bool tcp_process_frto(struct sock *sk, int flag)
>  		}
>  	} else {
>  		if (!(flag & FLAG_DATA_ACKED) && (tp->frto_counter == 1)) {
> +			if (!tcp_packets_in_flight(tp)) {
> +				tcp_enter_frto_loss(sk, 2, flag);
> +				return true;
> +			}
> +				
>  			/* Prevent sending of new data. */
>  			tp->snd_cwnd = min(tp->snd_cwnd,
>  					   tcp_packets_in_flight(tp));

Thanks Ilpo.

I'll be able to test your patch under load only in ~8 hours.

  reply	other threads:[~2013-02-04 15:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23 16:12 Linux 3.6.x kernel crash in tcp_slow_start / bictcp_cong_avoid with wfica Pasi Kärkkäinen
2013-01-23 21:44 ` Hannes Frederic Sowa
2013-01-23 21:51   ` Pasi Kärkkäinen
2013-01-23 22:00     ` Hannes Frederic Sowa
2013-01-24  7:14       ` Pasi Kärkkäinen
2013-01-23 22:25     ` Eric Dumazet
2013-01-23 23:26     ` Stephen Hemminger
2013-01-23 23:41       ` Hannes Frederic Sowa
2013-01-23 23:47         ` Eric Dumazet
2013-01-24  6:59           ` Pasi Kärkkäinen
2013-01-24 13:51           ` Hannes Frederic Sowa
2013-02-02  3:51             ` Eric Dumazet
2013-02-02 14:28               ` Pasi Kärkkäinen
2013-02-02 15:14                 ` [PATCH] tcp: tcp_process_frto() should not set snd_cwnd to 0 Eric Dumazet
2013-02-02 15:57                   ` Neal Cardwell
2013-02-02 17:32                     ` Eric Dumazet
2013-02-03 19:13                       ` [PATCH] tcp: frto " Eric Dumazet
2013-02-03 21:01                         ` David Miller
2013-02-04 12:14                         ` Ilpo Järvinen
2013-02-04 15:07                           ` Eric Dumazet [this message]
2013-02-05 19:44                             ` Eric Dumazet
2013-02-05 19:49                           ` Neal Cardwell
2013-02-06 20:55                             ` David Miller
2013-02-06 21:13                               ` Pasi Kärkkäinen
2013-02-06 21:19                                 ` David Miller
2013-02-06 21:21                                   ` Pasi Kärkkäinen
2013-02-02 15:23                 ` [PATCH] tcp: fix an infinite loop in tcp_slow_start() Eric Dumazet
2013-02-03 21:01                   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359990461.30177.142.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hannes@stressinduktion.org \
    --cc=ilpo.jarvinen@helsinki.fi \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pasik@iki.fi \
    --cc=stephen@networkplumber.org \
    --cc=ycheng@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox