Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1702312pxb; Fri, 25 Mar 2022 04:06:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZodEifxGrVHcOxnqcxC6XrR5x1/BLJHJy/PKc/B1Hd1ciwRxkFTPsNFEBruUTR0FyNjIb X-Received: by 2002:a65:5941:0:b0:375:9bfd:473d with SMTP id g1-20020a655941000000b003759bfd473dmr7566013pgu.348.1648206366305; Fri, 25 Mar 2022 04:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648206366; cv=none; d=google.com; s=arc-20160816; b=uJ5EG886VCgFMLlxWb0Ab0SvCnkr7ZsyZBFwWbLE1CvbneRtQ0utJVcUKoOXu4lrBm 9FzPg7ViCn52kPdwkmcGq0QmNEHymo7RmzlSbQIdOKJJeJNLZhrqeG07dIdYfVib6IwD zbvHdz91kPHLa/+4JeZGKvjv3Obg1rmyIM7amtPi29qCNzzRswak/RUHBBedwegIyotH eXW6+LtGZCdqiAmqqsnqMir/Wb684GMer2Kk+Bfu9se2UTsucrC6WF87Yk4sJDXI79mC 9UpuK0R1yizY2emDxGL0dPGbR2PkF6RI+7HZwK2UFrWzBAMlbfc5tv0JHlaKsR42fFYk iyPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=64vXsH3fzVmHQBxBaDFf3fKZQaMn2NWM0yDzy2WT0eI=; b=G3mdss/uSH57yEejj/1rw+nJ2apE170MieAHKnvkB4efs0Le/o2gtn5/++IJ0fl1YU mFsV/tDoGUpUSO2ZNzKpBFAB+l6/s0gs17DVk3jwNtNM/+pwdLXwOC/RfvnuMEhGOX6V dVbC0flcXPMUif09BseR0MfJHWhMXuBk8x82zIVYOQSJNWZCVu100c0PVl50kRHLz+5X 5HwZToFnmyPSwwTsFTJHhqjC1gDcIlxo3d36UjsPxXPMWZ9/DNKmT0Mxmsvw5FyyzUsh +09SbR35ZleWzaKv86udYqZhrQcnvEojcXCrBAq9Rf+PdRKu0CWkQTSWB6r+hKRE9Lxc d8bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ieDbLANh; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a056a00190a00b004fa3a8dffc0si2587251pfi.119.2022.03.25.04.05.53; Fri, 25 Mar 2022 04:06:06 -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=@redhat.com header.s=mimecast20190719 header.b=ieDbLANh; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349146AbiCXJQj (ORCPT + 99 others); Thu, 24 Mar 2022 05:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348150AbiCXJQi (ORCPT ); Thu, 24 Mar 2022 05:16:38 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 203B43F30B for ; Thu, 24 Mar 2022 02:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648113305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=64vXsH3fzVmHQBxBaDFf3fKZQaMn2NWM0yDzy2WT0eI=; b=ieDbLANhtveIIrFo0gVkvAUAe/PoFsMKyQrsrU7W3IJtAy07fErltelp/WSrgEKoAIE0en ejDJKts2qnOAv8WquRsegUwf4o833kU3Izl3AZFAtBiyofOo8jww2czq0M1PubbrfanMgP 3rQYWJXskmh7OCD2RgBi59CEFOYDgU8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-124-7xzJo55mMBaCJFoJewDD-Q-1; Thu, 24 Mar 2022 05:15:04 -0400 X-MC-Unique: 7xzJo55mMBaCJFoJewDD-Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 82DA418F0240; Thu, 24 Mar 2022 09:15:03 +0000 (UTC) Received: from shodan.usersys.redhat.com (unknown [10.43.17.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 31E09400E577; Thu, 24 Mar 2022 09:15:03 +0000 (UTC) Received: by shodan.usersys.redhat.com (Postfix, from userid 1000) id 402E71C0498; Thu, 24 Mar 2022 10:15:02 +0100 (CET) From: Artem Savkov To: tglx@linutronix.de, jpoimboe@redhat.com, netdev@vger.kernel.org Cc: davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org, linux-kernel@vger.kernel.org, Artem Savkov Subject: [PATCH v2 2/2] net: make tcp keepalive timer upper bound Date: Thu, 24 Mar 2022 10:15:00 +0100 Message-Id: <20220324091500.2638745-3-asavkov@redhat.com> In-Reply-To: <20220324091500.2638745-1-asavkov@redhat.com> References: <20220323184026.wkj55y55jbeumngs@treble> <20220324091500.2638745-1-asavkov@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 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. 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 fc2a985f6064..a8fea958960b 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -564,7 +564,7 @@ void inet_csk_init_xmit_timers(struct sock *sk, timer_setup(&icsk->icsk_retransmit_timer, retransmit_handler, 0); timer_setup(&icsk->icsk_delack_timer, delack_handler, 0); - timer_setup(&sk->sk_timer, keepalive_handler, 0); + timer_setup(&sk->sk_timer, keepalive_handler, TIMER_UPPER_BOUND); icsk->icsk_pending = icsk->icsk_ack.pending = 0; } EXPORT_SYMBOL(inet_csk_init_xmit_timers); -- 2.34.1