Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2421718iob; Fri, 6 May 2022 02:26:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK3MNUz1rnRVIrYm8puMg3rbvP2i69nyvWeY0A8iOQuAot53MCrgf6wBPayzfgQa5ONx20 X-Received: by 2002:a17:902:c14a:b0:15b:9c29:935a with SMTP id 10-20020a170902c14a00b0015b9c29935amr2706515plj.2.1651829166063; Fri, 06 May 2022 02:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651829166; cv=none; d=google.com; s=arc-20160816; b=aNH1giEtK4jTVuVRskiXjtXm8BzKznDMZv6R84ER/ZxpCpvwxp7g4QXojnXZH1I6r9 sQ6PrdB7TAm4kOrN8QQFbvKYH1wB6Rf6HgNobUfbTEPlsSrxbC3DzycgOGr+khqazwrN EeCxnKylDwH93PGL0++bhFTbslo9y8VLObr0TnI7htSH/Cl9YzW/V9NRqrxzpcmE3JXq jem+NF1XuO/k0sZsj03AWLrjJ/9woGRJdiLSqaOblJYKPXzQcvQaI6ER/ypj8uUZKCGg lMhVvk0pXPOn0OECsve/Izls0tjqgbAzz5nnVA07o5u7yBcjwahC6uDoVTZCVF6nJfeS taWg== 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=y4U5A3QRLZZuYGkS/ZCvQGsfk/VtHZAdLZlUMBaLLSs=; b=Jd1X7TMQUkpQ9kzqmeG8jiKQoW5ZR9Mmq3Zeb9tHqg3m1vwLGWr+ijSzLl8OhccDGt nPD9CxI3vL6QC1iqNLuezessvgD3yWQvv0XPPJ+wD0NqCYyNgGUK57wo+s5C65duwQfC Hw4Lq/UL+qanemkrqpCb1lpmN6vdI+WmVxiG0e14EmyStLzxO8I/nxb7x//JRuAywfuO H1i779aGAiXd2XF32O6M7Ui6rpQ0T82rvQ2215Mw4TPnu0nPN8ouRUGCc6k21lRDrOkV Zdvo16VWrTbf5srFDPdwBRmsGph4usewKdPS5bEi9Pqp9ESmTonDgBkPgjK9AlRO0YMD gN0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iSlHU6m2; 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 i18-20020a63e912000000b003aa30706009si4267599pgh.459.2022.05.06.02.25.30; Fri, 06 May 2022 02:26: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=iSlHU6m2; 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 S235022AbiEENWB (ORCPT + 99 others); Thu, 5 May 2022 09:22:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377912AbiEENV5 (ORCPT ); Thu, 5 May 2022 09:21:57 -0400 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [170.10.129.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D8FF32E684 for ; Thu, 5 May 2022 06:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651756698; 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=y4U5A3QRLZZuYGkS/ZCvQGsfk/VtHZAdLZlUMBaLLSs=; b=iSlHU6m2lCto68GhgNoK7Fg6P8icYzWwLIy9SiHircHIVBnGTmdgiMHzryzdqQMrcxUE1a NZOq85LAiMa3+FQLsfvvQQlD9BOhRZ8+S3iOBBTjyqp/Zxj9xxEUsdC4EA8uvZebNCwY2I mXJLD9PT7NLj2uaquDwSo5PW5z5i/ao= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-139-x5RIIweAMa-7fGeTvQYMFA-1; Thu, 05 May 2022 09:18:14 -0400 X-MC-Unique: x5RIIweAMa-7fGeTvQYMFA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 53086397968C; Thu, 5 May 2022 13:18:14 +0000 (UTC) Received: from shodan.usersys.redhat.com (unknown [10.43.17.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 159987B64; Thu, 5 May 2022 13:18:14 +0000 (UTC) Received: by shodan.usersys.redhat.com (Postfix, from userid 1000) id ED0F51C0223; Thu, 5 May 2022 15:18:12 +0200 (CEST) From: Artem Savkov To: Thomas Gleixner , Josh Poimboeuf Cc: Anna-Maria Behnsen , "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Artem Savkov Subject: [PATCH v5 0/2] Upper bound kernel timers Date: Thu, 5 May 2022 15:18:09 +0200 Message-Id: <20220505131811.3744503-1-asavkov@redhat.com> In-Reply-To: <87zgkwjtq2.ffs@tglx> References: <87zgkwjtq2.ffs@tglx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, 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 As previously discussed [1] we had a report of a regression in TCP keepalive timer where timers were up to 4 minutes late resulting in disconnects. This patchset tries to fix the problem by introducing upper bound kernel timers and making tcp keepalive timer use those. [1] https://lore.kernel.org/all/20210302001054.4qgrvnkltvkgikzr@treble/T/#u --- Changes in v5: - The least intrusive and most straightforward approach. This avoids touching any of existing code. The timeout supplied is always reduced by a known timer wheel error margin of 12.5%. - Commit message adjustments. Changes in v4: - Drop any attempts to be smart when calculating timer adjustment and always substract LVL_GRAN so that base clock lag won't be such a problem. This means that in some cases we will always be early, but all we want is not to be late. Changes in v3: - A different approach: instead of introducing upper bound timers try to account for timer wheen granularity on timer (re)arming step. - Not sure whether moving lvl calculation into a separate function is worth it. - Had a hard time naming the upper_bount_timeout() function - any suggestions welcome. Changes in v2: - TIMER_UPPER_BOUND flag description added as a comment in timer.h - Code style fixes - More elaborate commit message in timer commit Artem Savkov (2): timer: add a function to adjust timeouts to be upper bound net: make tcp keepalive timer upper bound include/linux/timer.h | 1 + kernel/time/timer.c | 14 ++++++++++++++ net/ipv4/inet_connection_sock.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) -- 2.34.1