[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGHK07BOhqiYsKkmVD70q-YVDfF8zhkFfFODpbFyf900fz1B7A@mail.gmail.com>
Date: Wed, 11 Jul 2018 12:34:34 +1000
From: Jonathan Maxwell <jmaxwell37@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Neal Cardwell <ncardwell@...gle.com>,
David Laight <David.Laight@...lab.com>,
kuznet <kuznet@....inr.ac.ru>,
yoshfuji <yoshfuji@...ux-ipv6.org>,
Netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Jon Maxwell <jmaxwell@...hat.com>
Subject: Re: [net-next,v3] tcp: Improve setsockopt() TCP_USER_TIMEOUT accuracy
On Wed, Jul 11, 2018 at 12:04 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
>
>
> On 07/10/2018 05:33 PM, Jonathan Maxwell wrote:
>> On Tue, Jul 10, 2018 at 10:48 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
>>>
>>>
>>> On 07/10/2018 05:38 AM, Eric Dumazet wrote:
>>>
>>>> Note that if we always do jiffies_to_msecs(icsk->icsk_user_timeout) in TCP,
>>>> we also could change the convention and store msecs in this field instead of jiffies.
>>>>
>>>> That would eliminate the msecs_to_jiffies() and jiffies_to_msecs() dance.
>>>>
>>>> (That would be done in a patch of its own, of course)
>>>
>>> tcp_keepalive_timer() does use icsk->icsk_user_timeout directly in jiffies unit,
>>> but considering keeapalive timers are rarely used, this point would have to
>>> do the msecs_to_jiffies() conversion.
>>
>> and also if icsk->icsk_user_timeout = 0, then timeout in retransmits_timed_out()
>> is in jiffies and that would need to addressed.
>
> Absolutely, this is what I was suggesting.
>
> Pseudo code for this part, before your changes.
>
> diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
> index 3b3611729928f77934e0298bb248e55c7a7c5def..cae7bbc956ed51e9d381650957f54550cc0967d9 100644
> --- a/net/ipv4/tcp_timer.c
> +++ b/net/ipv4/tcp_timer.c
> @@ -183,8 +183,9 @@ static bool retransmits_timed_out(struct sock *sk,
> else
> timeout = ((2 << linear_backoff_thresh) - 1) * rto_base +
> (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
> + timeout = jiffies_to_msecs(timeout)'
> }
> - return (tcp_time_stamp(tcp_sk(sk)) - start_ts) >= jiffies_to_msecs(timeout);
> + return (tcp_time_stamp(tcp_sk(sk)) - start_ts) >= timeout;
> }
>
> /* A write timeout has occurred. Process the after effects. */
>
>
That makes sense thanks. I'll look into this and get a patch together.
Powered by blists - more mailing lists