Message ID | 20230301141744.16063-15-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 v21csp3658980wrd; Wed, 1 Mar 2023 06:23:48 -0800 (PST) X-Google-Smtp-Source: AK7set/lh6ASGZLGIBFDPFnNy3/LxMD+5XA1WflYkyYBX304ZJD6SQ6lhM55lYXpT4k8DolIyh9Z X-Received: by 2002:aa7:ccd8:0:b0:4be:3918:9217 with SMTP id y24-20020aa7ccd8000000b004be39189217mr757853edt.8.1677680628737; Wed, 01 Mar 2023 06:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677680628; cv=none; d=google.com; s=arc-20160816; b=karaLRkR8Dlh1tuhVDWPymaWoUqeMe2wT/ZCpyqG8kGcrXktE5WWxpYJLJLNeAX2+Y WS8/Ew90dQFjk9l4g2Gm/bI+ab2mZ0LJ0AKRv54yjch0OgCQHpzUQGwD9xUJyUZGng5a qhM6P0xHYcSvL0crM0g6dg4ewhZnsZZlUHZB1ig+mbQMX+t7SD8M8D5zblyGG3ghliHS WGRIbdT/SH/CXdi63WbRDLxmq/tp0PxEXVtHUsv/kHHAxOULOuRwTrmFGPytbdXvE/nI MYKWETvI+RYurKvhj8U9jP2t71NLwKKV4XavHvCU7W5Z6NpRWYWz983k1eeSBwV3fuaH Om7w== 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=u6oVUtVUJMlppty9lAAWCtxtvp5SfOd42zCaYGloWms=; b=Y15OKW5M29SbRzn6CfKY02hzdSt/4Q4uxpOQHooTbq3vFQ0Cua/BIv3lHB0B9VSa7C VTLz6AB1FWe7lXNwoBUbZyNd/CCzk+fjIjJYvNYQysN5EWkVtE8odutHKhFhCG1h+mwF V3ON7vajIjn34Zs3EDf3l0kccR9e6oUWwQzuz4xF939KRzp1VS4NXgfRuQCnijBuOVXG rokLbgEy2E1Ej4y/9skn90m3UdsAH5HSAvTOs7mRL8jnP6Mt/HaILfDAECTRcRCjikSP pTl2HIYQXYabCJeqxj1GgMj/s3vaYgHq+uCTBIFcYaxVjnFMmo6HKpK+ZNjmYNLV+8YD /iWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rJRFd6NO; dkim=neutral (no key) header.i=@linutronix.de; 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 u4-20020aa7d544000000b004ad738a5cefsi15262071edr.248.2023.03.01.06.23.24; Wed, 01 Mar 2023 06:23:48 -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=rJRFd6NO; dkim=neutral (no key) header.i=@linutronix.de; 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 S230120AbjCAOTO (ORCPT <rfc822;david.simonyants@gmail.com> + 99 others); Wed, 1 Mar 2023 09:19:14 -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 S230048AbjCAOSL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 1 Mar 2023 09:18:11 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE5023DA4 for <linux-kernel@vger.kernel.org>; Wed, 1 Mar 2023 06:18:10 -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=1677680288; 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=u6oVUtVUJMlppty9lAAWCtxtvp5SfOd42zCaYGloWms=; b=rJRFd6NOExYRfgT5nUW82t+EbfhJXKGEn+S4VrbWmOaUrRCVmkH0Z4aVUjVf1ghpT1L+Cu 1z7wFyjMtSctofwD0dhyLCKgi5sBXrLLWggPm0uyYnWdOids2qOXOY2Nn8rSczq1SMFPul HAvqboFCms/NIg7HXcNPqDdyTHVRDldIAFuRvejog1SHUJPYfO2gJGkYfRCD9N29p9JTFm O7vjcKC/ZU/kcWmXjhw8TTUAG6KOnx5LWoeDZ9ZpkYuOGiaS712ItMYdX7UTKa4KtFcVVO +kvgTECWLTpoDP20ixLWyzw7Jb56jxqAoH4YRtPZRfQhbPx7vM+3VUZ/csAyXA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1677680288; 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=u6oVUtVUJMlppty9lAAWCtxtvp5SfOd42zCaYGloWms=; b=H3Sg05TucHQ4eIeUoWGT/6UIuntHMs16WRxX+dYai1BoYVUOoOyK7Iedwlfgf3vGnLESI+ iL5bcenD6+DaY+Cw== 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 14/18] timer: Check if timers base is handled already Date: Wed, 1 Mar 2023 15:17:40 +0100 Message-Id: <20230301141744.16063-15-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?1759175642592533246?= X-GMAIL-MSGID: =?utf-8?q?1759175642592533246?= |
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
Due to the conversion of the NOHZ timer placement to a pull at expiry
time model, the per CPU timer bases with non pinned timers are no
longer handled only by the local CPU. In case a remote CPU already
expires the non pinned timers base of the local cpu, nothing more
needs to be done by the local CPU. A check at the begin of the expire
timers routine is required, because timer base lock is dropped before
executing the timer callback function.
This is a preparatory work, but has no functional impact right now.
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
---
kernel/time/timer.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Wed, Mar 01, 2023 at 03:17:40PM +0100, Anna-Maria Behnsen wrote: > Due to the conversion of the NOHZ timer placement to a pull at expiry > time model, the per CPU timer bases with non pinned timers are no > longer handled only by the local CPU. In case a remote CPU already > expires the non pinned timers base of the local cpu, nothing more > needs to be done by the local CPU. A check at the begin of the expire > timers routine is required, because timer base lock is dropped before > executing the timer callback function. > > This is a preparatory work, but has no functional impact right now. > > Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> > --- > kernel/time/timer.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/time/timer.c b/kernel/time/timer.c > index be085e94afcc..9553da99e262 100644 > --- a/kernel/time/timer.c > +++ b/kernel/time/timer.c > @@ -2144,6 +2144,9 @@ static inline void __run_timers(struct timer_base *base) > > lockdep_assert_held(&base->lock); > > + if (!!base->running_timer) > + return; You can leave out the double-negation, 'if (base->running_timer)' is equivalent and reads much easier. > while (time_after_eq(jiffies, base->clk) && > time_after_eq(jiffies, base->next_expiry)) { > levels = collect_expired_timers(base, heads); > -- > 2.30.2 >
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index be085e94afcc..9553da99e262 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2144,6 +2144,9 @@ static inline void __run_timers(struct timer_base *base) lockdep_assert_held(&base->lock); + if (!!base->running_timer) + return; + while (time_after_eq(jiffies, base->clk) && time_after_eq(jiffies, base->next_expiry)) { levels = collect_expired_timers(base, heads);