Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp905019rdb; Fri, 1 Dec 2023 01:29:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3OxfbxXBJM1LDjmWrAJzys9SDUO8XZGEaksjLlCNaWe9iAhLPRSDjTuyTHbf1QetiEM6I X-Received: by 2002:a05:6e02:dc6:b0:35c:bbb8:d4b with SMTP id l6-20020a056e020dc600b0035cbbb80d4bmr17940847ilj.8.1701422953501; Fri, 01 Dec 2023 01:29:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701422953; cv=none; d=google.com; s=arc-20160816; b=TavIxoue93ADoqcmxj2saKw3puB9p1A6Fm+6Z+Xy5BbkvkztyLxMOcuntqLmV8LKJ+ iomei/LprBTuulaQoqDci2UoSqfG6LOt0nGW9LPx7u+LjPtoCzLU7ec7W2l8IzKpj7fH 8IGS7S9B2l31oiGv3EWsMBZutWCevtcqFOJi4SyWVtt19sT01IJ4Bh9pkD3xhPwS3oGi B3HT17wQORKUA+IueRA7zzLSP7AyfG5Y84ZTuxYZ6eRAsW4A2XlJgZ7lhb85dbyRJtcE m7Fx5XyMNF25JdNPSTMNVqWVO6DedWFqZHkdnuvOppterd2Z1CSRlGQioYC79B32F5rM FC0A== 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=eJA4rUNXEYpQORMvzo1itCOqghLSNPP1k7n+/ZfaqQw=; fh=H6hHKnScvHhKAB7z8Wb75LBNJxB0aNyPhv3ZCgyEYhY=; b=bOTzszmW05I7EduIApKFw5hBSHOsj5THWj+gJT1zbKc7j2StyIOMZMJTei8HhEj60e QH8PmaxTGyQswTheqTMr441ezCUao5xDutiDLnMO88gZqszAsjEvlv9R7BhlNursR1Iu O+nDQbT1b1VAiIdHeNrtUEMA8993UUTi1lmPARVvcZJ+q6lfYTPw9poQC1SnSq9CGw/N e/qE0fG77DnXjHRxRlQUJe8O6O+ww0gDZoZpIYMExPreDBbYkSoWZgozuaSmcBOJ4UZf 0KBpneArHHVaYgYOpcFrchY2tkBfYbXdAQ5lGHvVd+EsthfpYux3SN1XHloxVrHaUVkd uArg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kEhWR6Bp; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=PwBCPeVi; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q35-20020a631f63000000b00565e0624182si2923727pgm.404.2023.12.01.01.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:29:13 -0800 (PST) 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=kEhWR6Bp; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=PwBCPeVi; 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 0A97A80FA87E; Fri, 1 Dec 2023 01:29:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378141AbjLAJ2z (ORCPT + 99 others); Fri, 1 Dec 2023 04:28:55 -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: 8bit 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,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 01 Dec 2023 01:29:12 -0800 (PST) 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 basem, 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); } -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; - /* Read jiffies and the time when jiffies were updated last */ do { seq = read_seqcount_begin(&jiffies_seq); basemono = last_jiffies_update; basejiff = jiffies; } while (read_seqcount_retry(&jiffies_seq, seq)); + *basej = 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 = get_jiffies_update(&basejiff); ts->last_jiffies = basejiff; ts->timer_expires_base = basemono; -- 2.39.2