Message ID | 20230301141744.16063-8-anna-maria@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3658643wrd; Wed, 1 Mar 2023 06:23:08 -0800 (PST) X-Google-Smtp-Source: AK7set/CjP7ZScNaaNiGzhLIfqjdAsn1xp0PF1FOorEw/5o1XoO2UbgTJC15uu941MOjozUFSiGJ X-Received: by 2002:a17:906:48ca:b0:8f1:937c:f450 with SMTP id d10-20020a17090648ca00b008f1937cf450mr6183132ejt.13.1677680587961; Wed, 01 Mar 2023 06:23:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677680587; cv=none; d=google.com; s=arc-20160816; b=yVd/cICvI+RvEjsQQYkCg0DehKDH9j+kRYpo7XgL2yN/stqbj0ugq2lVLUqZ3iY7x2 uVuglvofG7XpKO62oK63PKBL+PplStZP4hrh8cIKys7ysLw1gPh4YVzJswASKQzq3haW zC2pEsgcGf2hLKj2nx3dHSOEo2KmbylTh36dqWF6/hDAGx3R7p7C2adu8JnM9P45IInz wN1hYkHNCb3tk0EO1qmIzYwdVLfN0QqILVt/+DNtrIKuyWF2UtttxRfuJ7ImUm7CdVQy 7/1AAQHCsut3QL9VT6XGg2jiSjGvCjn9/MEGyVyhDmlnTUTrL2URcvU9O9UNpPponwlm TYBA== 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=pdbSgLslPmcPgItz29y18IhXxIbpFPnnUkwjNqQj+/I=; b=KlIVhwwGJ2aVtm2Rf2bR5xh4XeZ0m3MFxclvl7B1oh8W3VcrtM5GyIK79e8j1oUXGf M86v0UrjJvOmJAZm4a7UOg7/Nto9k2soXiJPd36JCiPJC4JF52uTidTxQlJdXPe0Pi50 75mDC6X5c6g/pMl2lQ4zZHM7Oeuv42dVHrFNMFHqf79FQxRopyBA1cgJBd4V9EDP8JpD YZr2gByzH0Qnlp3covXWqwX1fHi14vXj7MG54EJaK4LqUBF+FZI9Ly5u0nCLgcMD9V8W 9WTaPU8B88uNR29YgVEUkqCg5wUkoDUjmu1tuL+T6XvWsBn5MuwAmLqFSegtYwxxiupP rp9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kdRAvwzm; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=aGnRgYH9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ce26-20020a170906b25a00b008cfc3be35f6si15105721ejb.646.2023.03.01.06.22.44; Wed, 01 Mar 2023 06:23:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kdRAvwzm; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=aGnRgYH9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230116AbjCAOTB (ORCPT <rfc822;david.simonyants@gmail.com> + 99 others); Wed, 1 Mar 2023 09:19:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbjCAOSJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 1 Mar 2023 09:18:09 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBA962E822 for <linux-kernel@vger.kernel.org>; Wed, 1 Mar 2023 06:18:07 -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=1677680285; 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=pdbSgLslPmcPgItz29y18IhXxIbpFPnnUkwjNqQj+/I=; b=kdRAvwzm4OaR9OSE+hCZ2Z+1tZkRsCTw9fEsGRaVm904YQvE4Yv5DCAdiAinJ3CBWXni5G iWU1J6V+GxlQez5MunpLVnxD+vcDBXMHLkFkJ1pVmQgZwXkUHIuoWbKGxQylzq295cfskn oNHtGxGsDTeKITFP6Pg8lxTPeUGrxzinv3Swe9ScFCNgoyEUPUGu+Cz3DlrLugJEsM7aDf RTHSMYZqxmX2StmvWJwIPsVwsL2j1uFbBpfgsI6MLl0ZN60X3W4d11gfpfgUnAdVrLeRIV NHL2skas4RnRubw+cLaPtKjtWO4PdeSO5+8YniwOg2UPey7a2UW2kWTgLghxjw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1677680285; 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=pdbSgLslPmcPgItz29y18IhXxIbpFPnnUkwjNqQj+/I=; b=aGnRgYH9dOdbi+nZxO3yuGEPkIGWxsbkVMmrXvXUkzA3XkjWHaYujIebGohEXaCFdSqWHE qEf8jXH30jlQ0vCQ== 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 <fweisbec@gmail.com>, Rik van Riel <riel@surriel.com>, Anna-Maria Behnsen <anna-maria@linutronix.de> Subject: [PATCH v5 07/18] timers: Ease code in run_local_timers() Date: Wed, 1 Mar 2023 15:17:33 +0100 Message-Id: <20230301141744.16063-8-anna-maria@linutronix.de> In-Reply-To: <20230301141744.16063-1-anna-maria@linutronix.de> References: <20230301141744.16063-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 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759175600500108288?= X-GMAIL-MSGID: =?utf-8?q?1759175600500108288?= |
Series |
timer: Move from a push remote at enqueue to a pull at expiry model
|
|
Commit Message
Anna-Maria Behnsen
March 1, 2023, 2:17 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>
---
v5: New patch to decrease patch size of follow up patches
---
kernel/time/timer.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
Comments
On Wed, Mar 01, 2023 at 03:17:33PM +0100, Anna-Maria Behnsen wrote: > 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>
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index d74d538e06a2..d3e1776b505b 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2058,16 +2058,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); } /*