From patchwork Wed Oct 4 12:34:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna-Maria Behnsen X-Patchwork-Id: 148257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp98457vqb; Wed, 4 Oct 2023 05:36:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1THCt29XKwvF6X8lYwaQGZ+mvFfTG3uLdXLWLTnPQyvl7zt7qvlXPbBcT8a1dFYYCpEOd X-Received: by 2002:a05:6a20:7d85:b0:15c:b7bb:2bb5 with SMTP id v5-20020a056a207d8500b0015cb7bb2bb5mr2658212pzj.7.1696422991540; Wed, 04 Oct 2023 05:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696422991; cv=none; d=google.com; s=arc-20160816; b=FtQNVMF15HrFu4EUVjPOz4ZAZwHKzsZvg9ePDwttWgdWt1SpGTIWaDoC53Nq15HLzl +54Zq32T7q9Kurh3eJBMkR8szzVW39tRH9K0z2DrIYi77DB2jvjcoTHos4Sm5HZX8UgM BmRwZh3ya6bemtAh/J52jS1j7IW/b7wUyb7FfhfyrZov+07XS3E0jSWPL18gowr6U3wl AQTkgXuG5SuGq7jqTpZedCJu4Ee/qSGNtQ5iKP4iwivRTQVRwY8asSbtSv4UePW/eFMq eXQokr67ZKDuLrFsrjoqDnQVLnUbh3U4yUNEfLNaQ+7BwUtxvmNxxX/4ljkoYnXI/f3+ Smaw== 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:dkim-signature :dkim-signature:from; bh=MAxMuF84OJMFwj1mVQcHjPmQ7zTcHiYKK0tzuJi+A1g=; fh=PG6uS4TiiUSDyl8D/joYkWbwCgDm4ug0ir2h7tHBJXQ=; b=FjB3AuNMr6wr7fOpFxnC170uQvoMeeJopQJSfbakyWrmumh+jc8sYxmwASNX8wyrwI bAy0QrVvgGgTzJqCYqxSIVLrS337tg3CAkRyLMP/VGr746iYrLvvF0ZgACCcqVDBou5W T1BixiXfNHSH5g5+zLkQ0AMYA0gThUd5NVVd2LNDOtw+50DE/WSXDGat1a3xcu0SKPci Y1nHmpvwLGamb/p06+H7XATBydU1Qj9c9QhdDcwIBl79I58LEvgZv57MSJaR0HyeBvE1 wNgMQs6kwhbCcc33Ab8x5/RL0ZtOwCNQZGHAjztagT7kBfFj1LLSGe1aGb0bLPrbvoe6 HDtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=NGiVHVMK; dkim=neutral (no key) header.i=@linutronix.de header.b=gKxbWVn7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k8-20020a056a00134800b0068fb4842092si3817911pfu.183.2023.10.04.05.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 05:36:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=NGiVHVMK; dkim=neutral (no key) header.i=@linutronix.de header.b=gKxbWVn7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5061B802C8ED; Wed, 4 Oct 2023 05:35:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242389AbjJDMfl (ORCPT + 18 others); Wed, 4 Oct 2023 08:35:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242353AbjJDMfc (ORCPT ); Wed, 4 Oct 2023 08:35:32 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E5EEC1 for ; Wed, 4 Oct 2023 05:35:29 -0700 (PDT) From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696422928; 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=MAxMuF84OJMFwj1mVQcHjPmQ7zTcHiYKK0tzuJi+A1g=; b=NGiVHVMKQ89c2HqOfoJKJwMmDbG3+ohTltyLW1E7IzR22caosCulch2P490f0kWBtaRGbd KP5bDXJydfUfFPuGaFqTJoEaiU4X8XdW6VuMYFTjcxawK5VKBkZp+P2ru5yzT2IChIeBl2 h9hafLvRBdvbqm0ZSRTQGkIVtuQFJzvxqKInsDdDPIe81yEn0wy1tWSjjQPQSDbV/6nhi7 2FxeM2e2LTe97EvaNLypD/daOhdNiUaZmnv+Q8j7qp8W8Z9S7NKJCWlmEyeQhv7w42HX9O rLCLIWFywCAaqkpPlmTd+TFh4v4M0AjIXALAy3o2Gjit+veJaQMQ0+7mS/TAfg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696422928; 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=MAxMuF84OJMFwj1mVQcHjPmQ7zTcHiYKK0tzuJi+A1g=; b=gKxbWVn7euG7rhu4l9t6pbj4lH9l8lg3FF9JrO40qXbMHGCaS/OLkU6TC5pL3M6jikIBzB /JJFsQ9FYtojaeBg== To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Frederic Weisbecker , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak , Anna-Maria Behnsen Subject: [PATCH v8 04/25] timer: Move store of next event into __next_timer_interrupt() Date: Wed, 4 Oct 2023 14:34:33 +0200 Message-Id: <20231004123454.15691-5-anna-maria@linutronix.de> In-Reply-To: <20231004123454.15691-1-anna-maria@linutronix.de> References: <20231004123454.15691-1-anna-maria@linutronix.de> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 05:35:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778828435077614258 X-GMAIL-MSGID: 1778828435077614258 Both call sites of __next_timer_interrupt() store return value directly in base->next_expiry. Move the store into __next_timer_interrupt() and to make its purpose more clear, rename function to next_expiry_recalc(). No functional change. Signed-off-by: Anna-Maria Behnsen Reviewed-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker --- v6: Fix typos in commit message and drop not required return as suggested by Peter Zijlstra v4: rename function as suggested by Frederic Weisbecker --- kernel/time/timer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 7d06351aff54..5e17244a9465 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1800,8 +1800,10 @@ static int next_pending_bucket(struct timer_base *base, unsigned offset, /* * Search the first expiring timer in the various clock levels. Caller must * hold base->lock. + * + * Store next expiry time in base->next_expiry. */ -static unsigned long __next_timer_interrupt(struct timer_base *base) +static void next_expiry_recalc(struct timer_base *base) { unsigned long clk, next, adj; unsigned lvl, offset = 0; @@ -1867,10 +1869,9 @@ static unsigned long __next_timer_interrupt(struct timer_base *base) clk += adj; } + base->next_expiry = next; base->next_expiry_recalc = false; base->timers_pending = !(next == base->clk + NEXT_TIMER_MAX_DELTA); - - return next; } #ifdef CONFIG_NO_HZ_COMMON @@ -1930,7 +1931,7 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem) raw_spin_lock(&base->lock); if (base->next_expiry_recalc) - base->next_expiry = __next_timer_interrupt(base); + next_expiry_recalc(base); nextevt = base->next_expiry; /* @@ -2013,7 +2014,7 @@ static inline void __run_timers(struct timer_base *base) WARN_ON_ONCE(!levels && !base->next_expiry_recalc && base->timers_pending); base->clk++; - base->next_expiry = __next_timer_interrupt(base); + next_expiry_recalc(base); while (levels--) expire_timers(base, heads + levels);