Message ID | 20231201092654.34614-10-anna-maria@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp991627vqy; Fri, 1 Dec 2023 01:27:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHazwP2bz5ds84o2sQOarfNyP7SncZK2rtM9xN8yrYyWQE77vGJRHWCjLWQivU4xNYRd1iw X-Received: by 2002:aa7:888f:0:b0:6ce:866:7bef with SMTP id z15-20020aa7888f000000b006ce08667befmr496795pfe.5.1701422864986; Fri, 01 Dec 2023 01:27:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701422864; cv=none; d=google.com; s=arc-20160816; b=OYN3dMza8Loatfy/U8bg/E6UNG5MRU95vejxdk/hQtJ+IyRiPcrByXA0lucgygejLy ng8Yvaa12gJ+UJU3OhTWl4orgDLHZZF2a7I/cJzJAk/2vt1PCaKKB0Y9m1LrZHAAd5ih N9C7QXxDWNxzQTGMUMzeZlHUMFwScj019x2dbE4L21BbaVJUEsp2/5AB2viGp5KbjZzE dv8dYuoKj2yKBUjhzpMWZqePjRjqAvO9lKvGyrc6hDxUyBvXdtTOxGeSVEA9g2GLop8P hvGuPhZ05dOom9GnWJyC77nljiQf5p54gmYsVxV6DhrQy6hb85bFtkmF+0JH84htOaM/ uBrg== 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=NX2OtYZi8wYLdH4/EBEFqndbEahIgfLRJkHvTArpnf8=; fh=PG6uS4TiiUSDyl8D/joYkWbwCgDm4ug0ir2h7tHBJXQ=; b=qlWYumZfGv/ejheOIATJVXcbmVHt3h/1/hUUeE9C54YrEbn7ezzpNU32t4SFqV4T3n 9+DoB8ntaKPADtNDhEklGBLqZXBZeOxHAd6OtiYBBbGjKEwUdkIs9Kco7yMr5Fjr+tT2 RxZJiv36BW6AkDpXTcQNpUIpb66sou5r3u94nFu8muM9UuTCoChj8+gLrig5WP7NTRWE Q83leN+9W09AWFM3uCEu25p13RA8i8DYAt9hS0uURw/u86UPOjCdx90ggfI7Qx+KSaTA voXwGX1t8l6IP9mvXxDgiXwuvSCaCxlm/u7ajjPv8HSh4cZ3oKWAOIFMKIl3NfdJ+fK0 TB/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1ggAH7wj; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id fd3-20020a056a002e8300b0068beee4922csi3135941pfb.23.2023.12.01.01.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:27:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1ggAH7wj; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 0FDC780ECF3F; Fri, 1 Dec 2023 01:27:44 -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 S1378099AbjLAJ1d (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Fri, 1 Dec 2023 04:27:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378035AbjLAJ1H (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 1 Dec 2023 04:27:07 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB89710FC for <linux-kernel@vger.kernel.org>; Fri, 1 Dec 2023 01:27:13 -0800 (PST) From: Anna-Maria Behnsen <anna-maria@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701422832; 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=NX2OtYZi8wYLdH4/EBEFqndbEahIgfLRJkHvTArpnf8=; b=1ggAH7wj+axl9TgEGJFZ0/uAb3cs+EW+X/QNAiGkGxhubO1WQ+ye67f57geO0uUgLmkZkL HvIPqcMu+1kgF6qnb72qlUj9+XGiJQS0qO4JNx9UYCX5iEGrK9FyAavNTYTSNwNpE9ghjY AfDEUuun8UgRzUrq7qEydbw/pXjJWUdOCUkmVDsiEWDsuPTYlj3u1B6Lr6HDIQzL2LG76+ kQcf4y/R6aiDYIlAQdaPPdghBaLiASdU2NCpEJEfA9zsdj9Hf9ZpuCbdej0w3aUOfxFDWQ ZNCAwSvoyAy9aMCi13puWX28GeFSL9rfPfL9btfjxsrP8FzpUmD8JWwSRMXaOQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701422832; 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=NX2OtYZi8wYLdH4/EBEFqndbEahIgfLRJkHvTArpnf8=; b=FWFW6/pnQLncFa4pPnDKR90jyaAVnwrvB+ARbjuC6CzkQWAsi8kK9Gc2XmjQxcA0arZv6p oCcqOjNaJyyrPcDg== To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra <peterz@infradead.org>, John Stultz <jstultz@google.com>, Thomas Gleixner <tglx@linutronix.de>, Eric Dumazet <edumazet@google.com>, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Arjan van de Ven <arjan@infradead.org>, "Paul E . McKenney" <paulmck@kernel.org>, Frederic Weisbecker <frederic@kernel.org>, Rik van Riel <riel@surriel.com>, Steven Rostedt <rostedt@goodmis.org>, Sebastian Siewior <bigeasy@linutronix.de>, Giovanni Gherdovich <ggherdovich@suse.cz>, Lukasz Luba <lukasz.luba@arm.com>, "Gautham R . Shenoy" <gautham.shenoy@amd.com>, Srinivas Pandruvada <srinivas.pandruvada@intel.com>, K Prateek Nayak <kprateek.nayak@amd.com>, Anna-Maria Behnsen <anna-maria@linutronix.de> Subject: [PATCH v9 09/32] timers: Split out forward timer base functionality Date: Fri, 1 Dec 2023 10:26:31 +0100 Message-Id: <20231201092654.34614-10-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: <linux-kernel.vger.kernel.org> 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:27:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784071182068885736 X-GMAIL-MSGID: 1784071182068885736 |
Series |
timers: Move from a push remote at enqueue to a pull at expiry model
|
|
Commit Message
Anna-Maria Behnsen
Dec. 1, 2023, 9:26 a.m. UTC
Forwarding timer base is done when the next expiry value is calculated and when a new timer is enqueued. When the next expiry value is calculated the jiffies value is already available and does not need to be reread a second time. Splitting out the forward timer base functionality to make it executable via both contextes - those where jiffies are already known and those, where jiffies need to be read. No functional change. Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> --- kernel/time/timer.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 66bac56909ba..e289cbd84e8c 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -939,30 +939,34 @@ get_target_base(struct timer_base *base, unsigned tflags) return get_timer_this_cpu_base(tflags); } -static inline void forward_timer_base(struct timer_base *base) +static inline void __forward_timer_base(struct timer_base *base, + unsigned long basej) { - unsigned long jnow = READ_ONCE(jiffies); - /* * Check whether we can forward the base. We can only do that when * @basej is past base->clk otherwise we might rewind base->clk. */ - if (time_before_eq(jnow, base->clk)) + if (time_before_eq(basej, base->clk)) return; /* * If the next expiry value is > jiffies, then we fast forward to * jiffies otherwise we forward to the next expiry value. */ - if (time_after(base->next_expiry, jnow)) { - base->clk = jnow; + if (time_after(base->next_expiry, basej)) { + base->clk = basej; } else { if (WARN_ON_ONCE(time_before(base->next_expiry, base->clk))) return; base->clk = base->next_expiry; } + } +static inline void forward_timer_base(struct timer_base *base) +{ + __forward_timer_base(base, READ_ONCE(jiffies)); +} /* * We are using hashed locking: Holding per_cpu(timer_bases[x]).lock means