Message ID | 20231201092654.34614-21-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 r17csp992033vqy; Fri, 1 Dec 2023 01:28:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1/Cy9HI/rhZbHh7t5J6jkIWlOECkFsvgxSMRdiRvAEXeLnto3HiREup+VW97A0XmTa2lz X-Received: by 2002:a9d:4d0a:0:b0:6d8:2843:8887 with SMTP id n10-20020a9d4d0a000000b006d828438887mr2200368otf.34.1701422923889; Fri, 01 Dec 2023 01:28:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701422923; cv=none; d=google.com; s=arc-20160816; b=M3gqpUEerIvu5+sZ2yD1ozOg9e9c1YzSv3cJyHwy3J8NOVO6dMaqHjQgRoQhq5DlO2 5YtX5fsGmEk7vUzYziMpuzVnyVbdbQrtunPCM1rbJijcNGi2FSKYPfGSvcPru/eSBcob dQQnz4SjVXkaB9HbisQuf9tInAz/kkbn2P/t5oefkAV9G1DKnHLk9KrTNCFwzQkjYO5R mqCJdePLKL7lbxZM08Ld39P2wAnfaQ9Pq7gr65L2PpBQ5Tne++aLYNG3Pz1Zc+1TLp2F w752K+zH5j2jiez9F7RscNX6e7ytxQGREp1fiXs06BmXErhrEX1PO9tdcQ/GM9343B7h KxCg== 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=HptRrZ5M792iqw/iN2UweCexRRIRvwfiQKQYLI/3wHc=; fh=PG6uS4TiiUSDyl8D/joYkWbwCgDm4ug0ir2h7tHBJXQ=; b=wZIMc+8uHJ+wWSwNrNzhNJfE1DEWLZ2ntiqzk3Qo+KKA2phP1aRYk2E+uhifQHyruz MeKVpEm1YRIhOo3vQNyc62t6Mm8PJEJS5G4KAkKxpe8vXxR8bcgBw9MLeiYE68shNlLU yKzdN7tb4/3Jri6PUHaz+bZVwkafW88vSCZiXS7/oPf4eVMkUHQO8MkL/PSPPAwzCDsp xNP518I7Fi28OPmYdpq123kTtieW/X7go9Jfc0LayBbxTu5PvOAmxJhiJM7GAtT/rUY2 8g01b5geGqF0jWY2qwZYz5GTuLCBIu3/Uhf0zH1OtNZqPsffwZSZMrmoUpaEqkHjJEaf qpEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="yTBAHA/p"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=L5L6rigw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g4-20020a635204000000b005be18ddf8b4si3087418pgb.646.2023.12.01.01.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:28:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="yTBAHA/p"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=L5L6rigw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 248BB80EAD53; Fri, 1 Dec 2023 01:28:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378227AbjLAJ2V (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Fri, 1 Dec 2023 04:28:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378144AbjLAJ1x (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 1 Dec 2023 04:27:53 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A161BC0 for <linux-kernel@vger.kernel.org>; Fri, 1 Dec 2023 01:27:22 -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=1701422840; 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=HptRrZ5M792iqw/iN2UweCexRRIRvwfiQKQYLI/3wHc=; b=yTBAHA/pD9Zi3YxjUh/mQPwH80wDQzu4NBOMSc/YlI4oybqc9oa+avtTTMz8Kf+WValTlA dlgISBVCf286D9fbca7mOEhZHUF/fAFl+SrOGDRZtFGcwqMIAvDyHD2cBjo+ebBS1CLvEY BXKYL4sowwjTmrKc4/uWkT8jC/FBfRqYPQGcgHMkXH8GrcgMASx+z1ttb8dMp23D7Ifp86 dwNPYPaYfxtbVjvmKlyr213mfH7G4EKdLJTnLXs1a3ogr5IK4ts3I8LmE4F7Oh8nBih1j6 8/itFyFnOyam5q9D2UY7ueoJkVx4/vtYSK3ZE08jUy2PONXP1WmfA9cIoISLVw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701422840; 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=HptRrZ5M792iqw/iN2UweCexRRIRvwfiQKQYLI/3wHc=; b=L5L6rigwBQq2b2USGQ9rEjf9ZzpKMx4OAE8/3HInusvYXAisr+mmjXdoDjX4CVFp3WP+ma yfayh02N64lbiAAw== 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 20/32] timers: Ease code in run_local_timers() Date: Fri, 1 Dec 2023 10:26:42 +0100 Message-Id: <20231201092654.34614-21-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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 01 Dec 2023 01:28:37 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784071244168657898 X-GMAIL-MSGID: 1784071244168657898 |
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
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 ea94479ee7e2..b14d84f1fe50 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2132,16 +2132,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); } /*