From nobody Mon Dec 29 05:03:40 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 442A4C4167B for ; Fri, 1 Dec 2023 09:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378032AbjLAJ25 (ORCPT ); Fri, 1 Dec 2023 04:28:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378182AbjLAJ2M (ORCPT ); Fri, 1 Dec 2023 04:28:12 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17AF510F9 for ; Fri, 1 Dec 2023 01:27:27 -0800 (PST) From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701422846; 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=eJA4rUNXEYpQORMvzo1itCOqghLSNPP1k7n+/ZfaqQw=; b=kEhWR6BpILpXBPleNuixEgrOHoHU+tSLpntkJXiwMC8Z3g/64p2VWGhRaqc+DO6Mn4EZt3 SO9QnO91MCwqCP4ALrC++C3NiTHGCv2Xj2yvjQiWf+xpDcizD47QTatabumYvok/s049QC Tz+T+2CbvsMSpwCdbPqfi5wVGiTaSj9thk/F3OpNgnFwDG4Vl09HX5UORn+Vz1m8M0spqJ 3HbiuMuItqnoTfzPiaP0bEMg1GB4c4GAs6osXO1jBr3jpHrsQaR2qP0WevQp63Mz1Z9o7M DymzebXlPg5BwTTWtHVUbz0zYCVu9+a2GQmWontxhQ9njwtYQ6QIra/RoFmvUQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701422846; 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=eJA4rUNXEYpQORMvzo1itCOqghLSNPP1k7n+/ZfaqQw=; b=PwBCPeViNGgkYRsSqSmBYt+Pw1wS+y9k7jm6ttbX8IIbrYXD4/2A5lmwrnK83nic0Y2ESy WLfgLJyWRc/AmGBA== 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 , "Richard Cochran (linutronix GmbH)" , Anna-Maria Behnsen Subject: [PATCH v9 28/32] tick/sched: Split out jiffies update helper function Date: Fri, 1 Dec 2023 10:26:50 +0100 Message-Id: <20231201092654.34614-29-anna-maria@linutronix.de> In-Reply-To: <20231201092654.34614-1-anna-maria@linutronix.de> References: <20231201092654.34614-1-anna-maria@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Richard Cochran (linutronix GmbH)" The logic to get the time of the last jiffies update will be needed by the timer pull model as well. Move the code into a global function in anticipation of the new caller. No functional change. Signed-off-by: Richard Cochran (linutronix GmbH) Signed-off-by: Anna-Maria Behnsen --- kernel/time/tick-internal.h | 1 + kernel/time/tick-sched.c | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 183ad32330fb..e0e58dd18919 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -158,6 +158,7 @@ static inline void tick_nohz_init(void) { } #ifdef CONFIG_NO_HZ_COMMON extern unsigned long tick_nohz_active; extern void timers_update_nohz(void); +extern u64 get_jiffies_update(unsigned long *basej); # ifdef CONFIG_SMP extern struct static_key_false timers_migration_enabled; extern void fetch_next_timer_interrupt_remote(unsigned long basej, u64 bas= em, diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index c6b415052c56..aca0e133ba09 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -799,18 +799,30 @@ static inline bool local_timer_softirq_pending(void) return local_softirq_pending() & BIT(TIMER_SOFTIRQ); } =20 -static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu) +/* + * Read jiffies and the time when jiffies were updated last + */ +u64 get_jiffies_update(unsigned long *basej) { - u64 basemono, next_tick, delta, expires; unsigned long basejiff; unsigned int seq; + u64 basemono; =20 - /* Read jiffies and the time when jiffies were updated last */ do { seq =3D read_seqcount_begin(&jiffies_seq); basemono =3D last_jiffies_update; basejiff =3D jiffies; } while (read_seqcount_retry(&jiffies_seq, seq)); + *basej =3D basejiff; + return basemono; +} + +static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu) +{ + u64 basemono, next_tick, delta, expires; + unsigned long basejiff; + + basemono =3D get_jiffies_update(&basejiff); ts->last_jiffies =3D basejiff; ts->timer_expires_base =3D basemono; =20 --=20 2.39.2