Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5427imm; Tue, 10 Jul 2018 19:36:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcKUIHdb6Zt/+mTcwYkLrQvlSq2z6UUd8vKtdaQvjMLjf5IYzltloJSZsMM3bxADeXOZnbX X-Received: by 2002:a63:460d:: with SMTP id t13-v6mr13834683pga.201.1531276568797; Tue, 10 Jul 2018 19:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531276568; cv=none; d=google.com; s=arc-20160816; b=TPudO13kmIB7EsYfGZO0V83dMOxQ3opTWA9flSzn6Z42dnxUaOyO+hcP10yux9t/vW 4AudtC+hw4MDZfy5/gnCwEMg600meNEzajdiXn1I7CXGsYyrkmvxxUozbmy1bmtujBqE b9+Ft7sLC3XgmOZOgTAmW4SsST3oqVchaRrfPZz08PqXrMJnX51KnI6aAlG/1QZVCGlE Gc3T3XSqEIQDEVIS2tUi18V7lCCt2hLD8jxsLguHvsRJDXk72Mo1Ej+A7odmY1mJ6aeV sYVjdbfRrwrELKGXl3AAxS+3T1e+F8efwx4ov7KIgF5jFtJCxEAi64oZfTG9Wh6bBmuQ QRWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=nRWRgznFFi80zEbm4C47FpyOl+Ew19gqtlF1TqbAlh8=; b=jxDSKfMTclgucBNRdJoHD7g+zH/oEW3PzWB1YqDLF0UkaruMd793eObrRLmmDCCGC2 TRierwpu06G4mZdHW3XSVbqksttbgl9kzUOpdqX8Kz0hkpgiaPP9WG4ri54/Tb5FFzqg tSa/tvZzJ7Xla40pos1k08jeK3wav9Yu/oAZfRRltPSgcTYVS0kieVHHd2pyIhnlZIfJ 1uPjb6tRTDTftmhrdrBsr2SSDRu2Cy8YjXIZcT11ybUeg5/UokG8GPwID8xRKPkdsl1n 5kTz932rJ4TNFrayd47pNxrS10VkLqPZbxUtLbKpL05/j3tpqwEeVXuud6g7CmTrohNY ee/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T9p5SzC3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4-v6si18270609pfi.184.2018.07.10.19.35.52; Tue, 10 Jul 2018 19:36:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T9p5SzC3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732423AbeGKChQ (ORCPT + 99 others); Tue, 10 Jul 2018 22:37:16 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37876 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732277AbeGKChP (ORCPT ); Tue, 10 Jul 2018 22:37:15 -0400 Received: by mail-wm0-f65.google.com with SMTP id n17-v6so882452wmh.2; Tue, 10 Jul 2018 19:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nRWRgznFFi80zEbm4C47FpyOl+Ew19gqtlF1TqbAlh8=; b=T9p5SzC3YMcIGV9QIOG5GjR3Gz2V/70lwAOP8fGz3KzbMklSOKW1KybgNlJDM0WY8g /5lCVW+9/AmjtoK0r0e3SiEKUSeqXiU2C60HA+t/y/ZFuZEUCrNf9TKC1yVzZPtqwGbN xuIr4rpX3f9vSTc1w9M89n5uHs8JBGc3ar663WE56Ji4ryt7JKks7fX5yImTQZbTX+4+ CFd6/8/mdyc94iW64pf1fgFn/eNQoR2iXBcEDRyEpPyB0ulPTU10NSV4rlF5mijyDsQf /IL3VJX/yL0LpWtY1hECrXJ3/okkusQ8ffp9D2NLppZjUQBbt/wYQ1vPppfNOYD1fHy5 +Yhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nRWRgznFFi80zEbm4C47FpyOl+Ew19gqtlF1TqbAlh8=; b=o97lgsFSSH9mDPbcwa4HmzqfnuxHgf17EU0NwH3XH1t1opGtCL6ydoJHbegfdSfI3a GADWywLEw9zlZz9WFOTYw6hXgj9+xRp37zyaj5g76R3wJx/orElTLDDR/7zJ7dqyIos0 vIESSFXiudzFBkFdSJ05g7/ffi6j9z+1ajquCJ2EuD032XedBaK5LQZkxHHEEQWUZZ+k B7zr/gXtgFSqegC0y4gYN0e0JmvoGSN2/5ecHEXjQSc3oilbOZwehW67zZHDifLIk07N JMjB4oQ/OU61LIKLthCxHhnjPYtdeCoiIE3WCzI92pJjXcGKMeyYS6rv8iRU0Xk0/evP 1mMw== X-Gm-Message-State: APt69E3KWALYBgt4N5PR9e/wc9T/JPxZcY/gY2bC1jLOpViVpEpJgUhJ q9Dou/tJXu/pfIKaSLK5z81oNLRiz17uYRA0azU= X-Received: by 2002:a1c:37cd:: with SMTP id e196-v6mr15112153wma.84.1531276514778; Tue, 10 Jul 2018 19:35:14 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:8a8a:0:0:0:0:0 with HTTP; Tue, 10 Jul 2018 19:34:34 -0700 (PDT) In-Reply-To: <46861e12-1ae5-374f-e907-87ba6241de5f@gmail.com> References: <20180710065147.27647-1-jmaxwell37@gmail.com> <3f856638-52bc-6630-a3d2-2b50f1bf7e48@gmail.com> <46861e12-1ae5-374f-e907-87ba6241de5f@gmail.com> From: Jonathan Maxwell Date: Wed, 11 Jul 2018 12:34:34 +1000 Message-ID: Subject: Re: [net-next,v3] tcp: Improve setsockopt() TCP_USER_TIMEOUT accuracy To: Eric Dumazet Cc: David Miller , Eric Dumazet , Neal Cardwell , David Laight , kuznet , yoshfuji , Netdev , LKML , Jon Maxwell Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 11, 2018 at 12:04 PM, Eric Dumazet wrote: > > > On 07/10/2018 05:33 PM, Jonathan Maxwell wrote: >> On Tue, Jul 10, 2018 at 10:48 PM, Eric Dumazet 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.