Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3203057iob; Fri, 6 May 2022 22:26:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEBeWt+8BussrRfEBbZJyS1sVkLP0CQ3Qs5fdteQZcffb0gn1i7EPu1SgJapvgiFEzi6W4 X-Received: by 2002:a05:6808:b19:b0:325:d028:7681 with SMTP id s25-20020a0568080b1900b00325d0287681mr6503885oij.195.1651901188381; Fri, 06 May 2022 22:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651901188; cv=none; d=google.com; s=arc-20160816; b=weq4wF9vCJAnTYMGqTbgxZYEWZgaWNWZpDh7kUUPNT1sX5ZWGjIAaJmh7xVbjFeMWl jOSGi3zfxv1QmhdHGY873ZoJuoAqcwPyRkzu4yxAnVkTcr5/WeWwGrCO+XL6hkGqC4GZ BJQHUSz9s3uGxKRYerRWcFvpZsjNIgMED0d+lO/NyQPGR/b4KyFsAJRT9IfqzBlP9A9c OcQj/ln2GUEPS2siozf66gm7jwHGVrCsRVSb8DA4ug03lE7b92y/q/hO7qgtWl+di+YK PLoq9YSGGxd6m972qUuN8N2q8SIH7QaXb6Mlx4zRZ1auF/FbEOH852hEKEugzEYHvfVK 9rmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kaiZVaPW3JE7L5BOFx5yrdalb7RHKl/dt+K/EOj2NrU=; b=c1jUwCS9x4Y97SH/6lMTgfLLYBisD7IsZpj8M4oQr6xmCUchH7EQJ+DFAHqBu5kGXL +PA5wMfaKTgPlXPi0OFAaWhX6eP9yK2sLTLZioq+hzxJHv5E3FflWrN+UBcx5P5uYsN/ YBWc5f1feJHN4ifjYoAY4ICehXq0TiWGf/22B6O86kp+5V37KtTefW4q874hs45iclvY KsYVFbZ85iIHQoheYd78Rg0Vow22mPZXMqMxUet9T78LLQQSBzAmTBaJ9OrOctQi+1YW CfrbdCls1AY1gG5OG3KyRWYQfqzIE2Zng2RLI9nWj22ph1cvlQr7xwvHChkIbZUDB8Jl NBcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p1nOCalo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a056870899100b000e1fc4a4f9fsi5341945oaq.125.2022.05.06.22.26.03; Fri, 06 May 2022 22:26:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p1nOCalo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443761AbiEFQ17 (ORCPT + 99 others); Fri, 6 May 2022 12:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348275AbiEFQ15 (ORCPT ); Fri, 6 May 2022 12:27:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB9106EB10; Fri, 6 May 2022 09:24:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A28B61FB9; Fri, 6 May 2022 16:24:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83FA7C385A9; Fri, 6 May 2022 16:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651854252; bh=wTXEscK9VBgHJe/fSlna6PK3W41cFBchYyGv8z2pebI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p1nOCalow/2RQwbMhADcIJBXbNSSDpU7ndJNAMZ+LklR/Ytf/Yk8pOkxXuDGMp4eM gP2IUNDuWrQDJb0PLMNEvLoS/S6s8wMtxFlY+CoM4fPh9Jj1IXCgNO8Jkag6TSHmBa xWR+wwShhvXYY//Xbqo66sdDofowm73XFvChIPGNVTdVFrxxindXpSnUZzl2YSA1F0 zdx38UmAW5uz5fs28TZqPNUoB8EdnjkSQSIyZd/EkmSTH9p3tKp3VxzP0a9bIkcE5A xTDo+H5OW7Us7vTESTUfLA26MTpoN7foivQz7ZYTonrPvGF7OyssneL1TKFtDBEomH iIr1h9KZs2ExQ== Date: Fri, 6 May 2022 09:24:10 -0700 From: Josh Poimboeuf To: Artem Savkov Cc: Thomas Gleixner , Josh Poimboeuf , Anna-Maria Behnsen , "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 2/2] net: make tcp keepalive timer upper bound Message-ID: <20220506162410.b5wkq4ybsiut4rzu@treble> References: <87zgkwjtq2.ffs@tglx> <20220505131811.3744503-1-asavkov@redhat.com> <20220505131811.3744503-3-asavkov@redhat.com> <20220505175654.jhu3zldboxdcjifr@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 06, 2022 at 08:39:08AM +0200, Artem Savkov wrote: > On Thu, May 05, 2022 at 10:56:54AM -0700, Josh Poimboeuf wrote: > > On Thu, May 05, 2022 at 03:18:11PM +0200, Artem Savkov wrote: > > > Make sure TCP keepalive timer does not expire late. Switching to upper > > > bound timers means it can fire off early but in case of keepalive > > > tcp_keepalive_timer() handler checks elapsed time and resets the timer > > > if it was triggered early. This results in timer "cascading" to a > > > higher precision and being just a couple of milliseconds off it's > > > original mark. > > > This adds minimal overhead as keepalive timers are never re-armed and > > > are usually quite long. > > > > > > Signed-off-by: Artem Savkov > > > --- > > > net/ipv4/inet_connection_sock.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c > > > index 1e5b53c2bb26..bb2dbfb6f5b5 100644 > > > --- a/net/ipv4/inet_connection_sock.c > > > +++ b/net/ipv4/inet_connection_sock.c > > > @@ -589,7 +589,7 @@ EXPORT_SYMBOL(inet_csk_delete_keepalive_timer); > > > > > > void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long len) > > > { > > > - sk_reset_timer(sk, &sk->sk_timer, jiffies + len); > > > + sk_reset_timer(sk, &sk->sk_timer, jiffies + upper_bound_timeout(len)); > > > } > > > EXPORT_SYMBOL(inet_csk_reset_keepalive_timer); > > > > As I mentioned before, there might be two sides to the same coin, > > depending on whether the keepalive is detecting vs preventing the > > disconnect. So this might possibly fix one case, while breaking > > another. > > But cascading is still there in the handler so it will fire off quite > close to original timer in any case. Ah, indeed it does. Sorry, I should try actually reading the patch description next time :-/ Looks good to me. Reviewed-by: Josh Poimboeuf -- Josh