netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Per Hurtig <per.hurtig@kau.se>
Cc: davem@davemloft.net, edumazet@google.com, ncardwell@google.com,
	nanditad@google.com, tom@herbertland.com, ycheng@google.com,
	viro@zeniv.linux.org.uk, fw@strlen.de, daniel@iogearbox.net,
	willemb@google.com, ilpo.jarvinen@helsinki.fi,
	pasi.sarolahti@iki.fi, stephen@networkplumber.org,
	netdev@vger.kernel.org, anna.brunstrom@kau.se,
	apetlund@simula.no, michawe@ifi.uio.no,
	mohammad.rajiullah@kau.se
Subject: Re: [RFC PATCH net-next 1/2] tcp: RTO Restart (RTOR)
Date: Mon, 7 Dec 2015 14:46:23 -0200	[thread overview]
Message-ID: <20151207164623.GA22976@mrl.redhat.com> (raw)
In-Reply-To: <4719073d7d8285006b2fe5f1b67a3fe5255c503e.1449478261.git.per.hurtig@kau.se>

On Mon, Dec 07, 2015 at 10:00:11AM +0100, Per Hurtig wrote:
> This patch implements the RTO restart modification (RTOR). When data is
> ACKed, and the RTO timer is restarted, the time elapsed since the last
> outstanding segment was transmitted is subtracted from the calculated RTO
> value. This way, the RTO timer will expire after exactly RTO seconds, and
> not RTO + RTT [+ delACK] seconds.
> 
> This patch also implements a new sysctl (tcp_timer_restart) that is used
> to control the timer restart behavior.
> 
> Signed-off-by: Per Hurtig <per.hurtig@kau.se>
> ---
>  Documentation/networking/ip-sysctl.txt | 12 ++++++++++++
>  include/net/tcp.h                      |  4 ++++
>  net/ipv4/sysctl_net_ipv4.c             | 10 ++++++++++
>  net/ipv4/tcp_input.c                   | 24 ++++++++++++++++++++++++
>  4 files changed, 50 insertions(+)
> 
> diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
> index 2ea4c45..4094128 100644
> --- a/Documentation/networking/ip-sysctl.txt
> +++ b/Documentation/networking/ip-sysctl.txt

(snip)

> @@ -2997,6 +2998,18 @@ static void tcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
>  	tcp_sk(sk)->snd_cwnd_stamp = tcp_time_stamp;
>  }
>  
> +static u32 tcp_unsent_pkts(const struct sock *sk)
> +{
> +	struct sk_buff *skb = tcp_send_head(sk);
> +	u32 pkts = 0;
> +
> +	if (skb)
> +		tcp_for_write_queue_from(skb, sk)
> +			pkts += tcp_skb_pcount(skb);
> +
> +	return pkts;
> +}
> +
>  /* Restart timer after forward progress on connection.
>   * RFC2988 recommends to restart timer to now+rto.
>   */
> @@ -3027,6 +3040,17 @@ void tcp_rearm_rto(struct sock *sk)
>  			 */
>  			if (delta > 0)
>  				rto = delta;
> +		} else if (icsk->icsk_pending == ICSK_TIME_RETRANS &&
> +			   (sysctl_tcp_timer_restart == 1 ||
> +			    sysctl_tcp_timer_restart == 3) &&
> +			   (tp->packets_out + tcp_unsent_pkts(sk) <
> +			    TCP_RTORESTART_THRESH)) {

(snip)

By when this gets hit, you could have a big write queue.
What about wrapping at least this this condition 
tp->packets_out + tcp_unsent_pkts(sk) < TCP_RTORESTART_THRESH
in its own check function? Like:

+static bool tcp_can_rtor(const struct sock *sk)
+{
+	struct sk_buff *skb = tcp_send_head(sk);
+	s32 target = TCP_RTORESTART_THRESH - tp->packets_out;
+
+	if (target <= 0)
+		return false;
+
+	if (skb) {
+		tcp_for_write_queue_from(skb, sk) {
+			target -= tcp_skb_pcount(skb);
+			if (target <= 0)
+				return false;
+		}
+	}
+
+	return true;
+}

This way it will only traverse what is needed for the check itself.

  Marcelo

  parent reply	other threads:[~2015-12-07 16:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07  9:00 [RFC PATCH net-next 0/2] tcp: timer restart for tail loss Per Hurtig
2015-12-07  9:00 ` [RFC PATCH net-next 1/2] tcp: RTO Restart (RTOR) Per Hurtig
2015-12-07 10:22   ` Ilpo Järvinen
2015-12-07 16:46   ` Marcelo Ricardo Leitner [this message]
2015-12-07 17:03   ` Eric Dumazet
2015-12-08  2:05   ` Yuchung Cheng
2015-12-08  9:25     ` Per Hurtig
2015-12-07  9:00 ` [RFC PATCH net-next 2/2] tcp: TLP restart (TLPR) Per Hurtig
2015-12-08  9:19 ` [RFC PATCHv2 net-next 0/2] tcp: timer restart for tail loss Per Hurtig
2015-12-08  9:19   ` [RFC PATCHv2 net-next 1/2] tcp: RTO Restart (RTOR) Per Hurtig
2015-12-08 10:50     ` Ilpo Järvinen
2015-12-08 11:03       ` Per Hurtig
2015-12-08 13:47     ` Eric Dumazet
2015-12-10  6:51       ` Per Hurtig
2015-12-10 15:37         ` Neal Cardwell
2015-12-10 21:11           ` Per Hurtig
2015-12-08  9:19   ` [RFC PATCHv2 net-next 2/2] tcp: TLP restart (TLPR) Per Hurtig

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=20151207164623.GA22976@mrl.redhat.com \
    --to=marcelo.leitner@gmail.com \
    --cc=anna.brunstrom@kau.se \
    --cc=apetlund@simula.no \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=ilpo.jarvinen@helsinki.fi \
    --cc=michawe@ifi.uio.no \
    --cc=mohammad.rajiullah@kau.se \
    --cc=nanditad@google.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pasi.sarolahti@iki.fi \
    --cc=per.hurtig@kau.se \
    --cc=stephen@networkplumber.org \
    --cc=tom@herbertland.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willemb@google.com \
    --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;
as well as URLs for NNTP newsgroup(s).