Message ID | 20231004123454.15691-15-anna-maria@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp98689vqb; Wed, 4 Oct 2023 05:36:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHB0u/pKXxMmb5YtlcAS/KhDnoHyIRTyp0qYJncIMCPBU77+PSr/InmMKnrtK0dMql9wJVt X-Received: by 2002:a05:6830:6b44:b0:6b7:4af2:492d with SMTP id dc4-20020a0568306b4400b006b74af2492dmr1802379otb.38.1696423005439; Wed, 04 Oct 2023 05:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696423005; cv=none; d=google.com; s=arc-20160816; b=BK568HXwCGa+henIoMH/SOEku7apVLGb1w4PEMxImxZj/j8dgdbQl0W4yby5ZroQ+X 5tXqGF7JeWwz8T2rekbCdtB0Bq/zYXHjyEwWEc0QSNt/D9F5ugMDCMuRG5YRCUZc760X 65LC91wEZglAiWCHywKrsowvHFGZN+gAV81X8PAxRPfN6/rCeLUPT15XyPNkiMMiPc+W 2WI4ml/2Gvt5dDiHkF1HaNoF/829xJHa39GD1Kd4yD9pwq+lmwQ/aiz8Z84xXZp7qXg2 rP1LXLV7PuKWm/o/WIUFhhDl3eTpdEAak8CVZ2iTg033I46cHHrfqKrQhHH/FCRvWD2o SV2g== 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=mz5QdBnNgn288WAkuPYs1KdwbgiRL6T25mdaPooSrW8=; fh=PG6uS4TiiUSDyl8D/joYkWbwCgDm4ug0ir2h7tHBJXQ=; b=tlRNBauRUs010cDiqII+kaVlVexxyj/JO9I9+ov7PzQp5kraU9zq97fBR2sCTqulsy a+gdG4hoK81RiR+NYy1IUP+4f0utZg8Hjn3l+ln+LKvyOYjxMvWNIxBr2UEMoRaf5V3s C2/iLLC/gzRXhLdY3vFuTSWS6v4ESd6upX5rxzzqENVHqMspdLOkuli3Ot+bhTRdBLgY ha2ScctZw1BkTqy717NBJmBVI5WHzFfmgavIsRmoLNHboDOziBn/j78Bf25IvsvjoCHa dllA2lQmRhKgt542jxWjMVsSR1mPZaiI4DznUa7w7Wlnn4u45ahBpR/gST4DHS85FI/D DG/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="dcV/kah2"; 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 t23-20020a656097000000b00585a6bdce46si3645282pgu.308.2023.10.04.05.36.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 05:36:45 -0700 (PDT) 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="dcV/kah2"; 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 323FE82159F2; Wed, 4 Oct 2023 05:36:14 -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 S242507AbjJDMgG (ORCPT <rfc822;pusanteemu@gmail.com> + 18 others); Wed, 4 Oct 2023 08:36:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242399AbjJDMfn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 4 Oct 2023 08:35:43 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 670A8E8 for <linux-kernel@vger.kernel.org>; Wed, 4 Oct 2023 05:35:35 -0700 (PDT) From: Anna-Maria Behnsen <anna-maria@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696422934; 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=mz5QdBnNgn288WAkuPYs1KdwbgiRL6T25mdaPooSrW8=; b=dcV/kah2sZANpyHtK1hKbSQiHNfz+pTcJF2EgsNt7jDpGibYjJsseIJ7OFgnJMkHFiv3p2 /pbWKF0G4x6E3qkx2rEANukPZvRYE1LHnMXvnEc0VSk7n1BnDGThcVuwfs7+fWy4PGfXiF m6Ktz2/fpAJR4AEpNbwPzA176y6uo/OHjupwRhUnC6boE1L07Gbka/dayr5kIc4PQt9GMu EUk86yjNl4sTOh8cfbdkIOKy6o99zD2Dx/pZ+BSZgQIMQY6U9PMg94SFos12YntSw1yhmY j3nz4JCISPYPboOLSG0QxW5N7DpZKPC0PrBxcGPqnCNwGh0taOVkx5dZTfFZpw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696422934; 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=mz5QdBnNgn288WAkuPYs1KdwbgiRL6T25mdaPooSrW8=; b=6yDPT0oLpbTKkm3ZNkk1/ZTUhSmoN0AelRNlyHvFGnRA2sh9eda4y8KSlCP0/klza4pdeO o+ABVbI11HfuZcAA== 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 v8 14/25] timers: Ease code in run_local_timers() Date: Wed, 4 Oct 2023 14:34:43 +0200 Message-Id: <20231004123454.15691-15-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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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: <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]); Wed, 04 Oct 2023 05:36:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778828449281985280 X-GMAIL-MSGID: 1778828449281985280 |
Series |
timer: Move from a push remote at enqueue to a pull at expiry model
|
|
Commit Message
Anna-Maria Behnsen
Oct. 4, 2023, 12:34 p.m. UTC
The logic for raising a softirq the way it is implemented right now, is readable for two timer bases. When increasing numbers of timer bases, code gets harder to read. With the introduction of the timer migration hierarchy, there will be three timer bases. Therefore ease the code. No functional change. Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> --- v5: New patch to decrease patch size of follow up patches --- kernel/time/timer.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 853a8ee48ffc..1aafa0edc74c 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2123,16 +2123,14 @@ static void run_local_timers(void) struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); hrtimer_run_queues(); - /* Raise the softirq only if required. */ - if (time_before(jiffies, base->next_expiry)) { - if (!IS_ENABLED(CONFIG_NO_HZ_COMMON)) - return; - /* CPU is awake, so check the deferrable base. */ - base++; - if (time_before(jiffies, base->next_expiry)) + + for (int i = 0; i < NR_BASES; i++, base++) { + /* Raise the softirq only if required. */ + if (time_after_eq(jiffies, base->next_expiry)) { + raise_softirq(TIMER_SOFTIRQ); return; + } } - raise_softirq(TIMER_SOFTIRQ); } /*