netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy
@ 2018-07-18  0:46 Jon Maxwell
  2018-07-18  1:20 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Maxwell @ 2018-07-18  0:46 UTC (permalink / raw)
  To: davem
  Cc: edumazet, eric.dumazet, ncardwell, David.Laight, kuznet, yoshfuji,
	netdev, linux-kernel, jmaxwell

Based on:

https://patchwork.kernel.org/patch/10516195/

Every time the TCP retransmission timer fires. It checks to see if 
there is a timeout before scheduling the next retransmit timer. The 
retransmit interval between each retransmission increases 
exponentially. The issue is that in order for the timeout to occur the
retransmit timer needs to fire again. If the user timeout check happens 
after the 9th retransmit for example. It needs to wait for the 10th 
retransmit timer to fire in order to evaluate whether a timeout has 
occurred or not. If the interval is large enough then the timeout will 
be inaccurate.

For example with a TCP_USER_TIMEOUT of 10 seconds without patch:

1st retransmit:

22:25:18.973488 IP host1.49310 > host2.search-agent: Flags [.]

Last retransmit:

22:25:26.205499 IP host1.49310 > host2.search-agent: Flags [.]

Timeout:

send: Connection timed out
Sun Jul  1 22:25:34 EDT 2018

We can see that last retransmit took ~7 seconds. Which pushed the total 
timeout to ~15 seconds instead of the expected 10 seconds. This gets 
more inaccurate the larger the TCP_USER_TIMEOUT value. As the interval 
increases.

Add tcp_clamp_rto_to_user_timeout() to determine if the user rto has 
expired. Or whether the rto interval needs to be recalculated. Use the 
original interval if user rto is not set. 

Test results with the patch is the expected 10 second timeout:

1st retransmit:

01:37:59.022555 IP host1.49310 > host2.search-agent: Flags [.]

Last retransmit:

01:38:06.486558 IP host1.49310 > host2.search-agent: Flags [.]

Timeout:

send: Connection timed out
Mon Jul  2 01:38:09 EDT 2018

Jon Maxwell (3):
  tcp: convert icsk_user_timeout from jiffies to msecs
  tcp: Add tcp_retransmit_time() helper routine
  tcp: Add tcp_clamp_rto_to_user_timeout() helper to improve accuracy

 net/ipv4/tcp.c       |  4 ++--
 net/ipv4/tcp_timer.c | 51 ++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 40 insertions(+), 15 deletions(-)

-- 
2.13.6

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

* Re: [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy
  2018-07-18  0:46 [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy Jon Maxwell
@ 2018-07-18  1:20 ` Eric Dumazet
  2018-07-18  1:55   ` Jonathan Maxwell
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2018-07-18  1:20 UTC (permalink / raw)
  To: Jon Maxwell, davem
  Cc: edumazet, eric.dumazet, ncardwell, David.Laight, kuznet, yoshfuji,
	netdev, linux-kernel, jmaxwell



On 07/17/2018 05:46 PM, Jon Maxwell wrote:
> Based on:
> 
> https://patchwork.kernel.org/patch/10516195/
> 

I must confess I am lost with your submissions.

Patchwork is also lost ( https://patchwork.ozlabs.org/project/netdev/list/ )

Are you really using git format-patch ?

Normally all the patches should have a common [PATCH Vx net-next] string

git format-patch -o ../output --cover-letter --subject-prefix "PATCH V3 net-next" HEAD~3

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

* Re: [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy
  2018-07-18  1:20 ` Eric Dumazet
@ 2018-07-18  1:55   ` Jonathan Maxwell
  2018-07-18  2:40     ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Maxwell @ 2018-07-18  1:55 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, Eric Dumazet, Neal Cardwell, David Laight, kuznet,
	yoshfuji, Netdev, LKML, Jon Maxwell

After committing the patches in my net-next git branch I used git send-mail:

git send-email --identity=XXX --cover-letter --annotate origin
--compose --signoff

and manually updated it based on an example of yours:

https://lwn.net/Articles/706491/

I can see the 3 patches that I just submitted on:

https://patchwork.ozlabs.org/project/netdev/list/

Flagged as under review by DaveM.

On Wed, Jul 18, 2018 at 11:20 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
> On 07/17/2018 05:46 PM, Jon Maxwell wrote:
>> Based on:
>>
>> https://patchwork.kernel.org/patch/10516195/
>>
>
> I must confess I am lost with your submissions.
>
> Patchwork is also lost ( https://patchwork.ozlabs.org/project/netdev/list/ )
>
> Are you really using git format-patch ?
>
> Normally all the patches should have a common [PATCH Vx net-next] string
>
> git format-patch -o ../output --cover-letter --subject-prefix "PATCH V3 net-next" HEAD~3
>
>

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

* Re: [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy
  2018-07-18  1:55   ` Jonathan Maxwell
@ 2018-07-18  2:40     ` Eric Dumazet
  2018-07-18  2:57       ` Jonathan Maxwell
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2018-07-18  2:40 UTC (permalink / raw)
  To: Jonathan Maxwell, Eric Dumazet
  Cc: David Miller, Eric Dumazet, Neal Cardwell, David Laight, kuznet,
	yoshfuji, Netdev, LKML, Jon Maxwell



On 07/17/2018 06:55 PM, Jonathan Maxwell wrote:
> After committing the patches in my net-next git branch I used git send-mail:
> 
> git send-email --identity=XXX --cover-letter --annotate origin
> --compose --signoff
> 
> and manually updated it based on an example of yours:
> 
> https://lwn.net/Articles/706491/
> 
> I can see the 3 patches that I just submitted on:
> 
> https://patchwork.ozlabs.org/project/netdev/list/
> 
> Flagged as under review by DaveM.
> 

I dunno, each patch belongs to a separate patch series, this is not expected.

Compare to what happens on https://patchwork.ozlabs.org/project/netdev/list/  for a proper submission.

If you click on https://patchwork.ozlabs.org/project/netdev/list/?series=56100  for example,
you can see 5 patch in a series.

Standard workflow : 

git-format-patch ...

<edit cover letter>

git send-email --to "David S. Miller <davem@davemloft.net>" \
	--cc "netdev <netdev@vger.kernel.org>" \
	--cc "Eric Dumazet <edumazet@google.com>" \
	00*

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

* Re: [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy
  2018-07-18  2:40     ` Eric Dumazet
@ 2018-07-18  2:57       ` Jonathan Maxwell
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Maxwell @ 2018-07-18  2:57 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, Eric Dumazet, Neal Cardwell, David Laight, kuznet,
	yoshfuji, Netdev, LKML, Jon Maxwell

Okay I see what you mean looking some examples on:

https://patchwork.ozlabs.org/project/netdev/list/

I'll resubmit with the correct patch series numbers but with
the same detailed description.

On Wed, Jul 18, 2018 at 12:40 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
> On 07/17/2018 06:55 PM, Jonathan Maxwell wrote:
>> After committing the patches in my net-next git branch I used git send-mail:
>>
>> git send-email --identity=XXX --cover-letter --annotate origin
>> --compose --signoff
>>
>> and manually updated it based on an example of yours:
>>
>> https://lwn.net/Articles/706491/
>>
>> I can see the 3 patches that I just submitted on:
>>
>> https://patchwork.ozlabs.org/project/netdev/list/
>>
>> Flagged as under review by DaveM.
>>
>
> I dunno, each patch belongs to a separate patch series, this is not expected.
>
> Compare to what happens on https://patchwork.ozlabs.org/project/netdev/list/  for a proper submission.
>
> If you click on https://patchwork.ozlabs.org/project/netdev/list/?series=56100  for example,
> you can see 5 patch in a series.
>
> Standard workflow :
>
> git-format-patch ...
>
> <edit cover letter>
>
> git send-email --to "David S. Miller <davem@davemloft.net>" \
>         --cc "netdev <netdev@vger.kernel.org>" \
>         --cc "Eric Dumazet <edumazet@google.com>" \
>         00*

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

end of thread, other threads:[~2018-07-18  2:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-18  0:46 [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy Jon Maxwell
2018-07-18  1:20 ` Eric Dumazet
2018-07-18  1:55   ` Jonathan Maxwell
2018-07-18  2:40     ` Eric Dumazet
2018-07-18  2:57       ` Jonathan Maxwell

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).