Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2757652rdh; Wed, 27 Sep 2023 11:43:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZ3o1QXoQICzrUahq6N7213Tm24YCYpYgwiVtBPfmSqpfleMp9J25AXLzs0F6nOa+IE5k4 X-Received: by 2002:a17:902:ab56:b0:1c5:d354:93b6 with SMTP id ij22-20020a170902ab5600b001c5d35493b6mr2409110plb.67.1695840212335; Wed, 27 Sep 2023 11:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695840212; cv=none; d=google.com; s=arc-20160816; b=cwypF/xfblVcK6GDQni91n6OWMDMdYWD05TshOMUAgvqTFnZ75+8FYTho+qpncEvtR nbCpk8dF7wmznUE3KMGUi/TFPNn88JhdFrjcp5IGRcRLtgrBRvpDUrsGtEs8ZC8kLgZh CMxSC21ZoqDFVnEix8hKW5CnwBIUybKNf1mmoAPlc3i1qKL8cQe4/cYsV5aQmWuPBSwq btzmAZMt/4/kVu/uvkgn78MBG4uDrUPQa8nBoinTdFyNEJ6Xh2p7YFVhBP3zKNn4vGdM waslZqf48y3pUcFSmQfa+oiky8qgR71WtIp4xLU3YMcSyFJNgtSWj1t2fojcbYtP07bM Y0vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=gBwqXzZPblG1ncLS43lGYrnNbOnW3bAsFhI96LBlU5g=; fh=AAnB8n3BQqQbeD3JBhCxFZya7F9ZuxdpKurn41kX2Qg=; b=sILEfvkEJ29i11DRsGuODxi6aKzNd68RHvwO11yInFShA/OkCuey3E39OTC5lI8suQ OvmX4ymfhZTC8W1Arht8QNDE+I9iV0QG4rW/jvcz0kW92YUiF8nlpdpFm5dxLrePv6St dHMQG4tDgX5/yCk9tYeYBmq6Q5N38YE/u1oHpqa+1PMFxNRy3AKWit+c3mV+9pB4pcXd ThidT6O9Q1/vu7/5NtNCaW6mAg5WNHhN7p3r55XGHxTk7UECXIRzl2OR3ZVW34GXAzXh gtDb0Ztp5xfkpmQ3H3BHsJV8SnNDQiW/b+j1K/b0vCUUH6L9D/FucW6ribgRTXU7ywFb kkuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qsABm6HZ; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id kb16-20020a170903339000b001c3fab52a94si15816706plb.212.2023.09.27.11.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:43:32 -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=qsABm6HZ; 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 2999E8191451; Wed, 27 Sep 2023 08:02:07 -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 S232302AbjI0PBx (ORCPT + 99 others); Wed, 27 Sep 2023 11:01:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232273AbjI0PBg (ORCPT ); Wed, 27 Sep 2023 11:01:36 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDF79192; Wed, 27 Sep 2023 08:01:33 -0700 (PDT) Date: Wed, 27 Sep 2023 15:01:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695826891; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gBwqXzZPblG1ncLS43lGYrnNbOnW3bAsFhI96LBlU5g=; b=qsABm6HZX825o3E4bTX7obwAWDl8AyY0rA8V7oM17PTAEhR6NJwhUWsVNBbMHgzWpc06MM mycdeStLix6qZykrVFB/LzofUfDNWAXSDgKOsIA3WCN6vSvtL0giWoSeEaPA5Hgd+BTAp1 A2zBzx8On0FygkkIpsGZL/pYNGddFwzCBtulgbdODylPTRqm8u+xc21pqzz1w75iuy859c Z/3pQvI5rb7qYZkSNZT/p7q8iW7DYHyp0vpcxq4hWXbXWkyt7RfNMzNOOmaJ65EczzWZ9z VSNnLFJqSogHk552vtPIxwl2pqycMER3IpK7gtBrExEkzFvb3P/VZkF2mmc1wQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695826891; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gBwqXzZPblG1ncLS43lGYrnNbOnW3bAsFhI96LBlU5g=; b=x/AD695BFQ3drhzQtTnKnOxEzb3gXPzTW7HsVCdOOeXlaMXmQTMMWFYVkBT++0CZfp92X+ VLza9VVUNpyxerCg== From: "tip-bot2 for Frederic Weisbecker" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] tick/nohz: Don't shutdown the lowres tick from itself Cc: Frederic Weisbecker , Thomas Gleixner , "Joel Fernandes (Google)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230912104406.312185-4-frederic@kernel.org> References: <20230912104406.312185-4-frederic@kernel.org> MIME-Version: 1.0 Message-ID: <169582689055.27769.5495044168356785862.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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: 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, 27 Sep 2023 08:02:07 -0700 (PDT) The following commit has been merged into the timers/core branch of tip: Commit-ID: 4f7f4409af289715f44685f250e380ce2cbffc7e Gitweb: https://git.kernel.org/tip/4f7f4409af289715f44685f250e380ce2cbffc7e Author: Frederic Weisbecker AuthorDate: Tue, 12 Sep 2023 12:44:04 +02:00 Committer: Thomas Gleixner CommitterDate: Wed, 27 Sep 2023 16:58:10 +02:00 tick/nohz: Don't shutdown the lowres tick from itself In lowres dynticks mode, just like in highres dynticks mode, when there is no tick to program in the future, the tick eventually gets deactivated either: * From the idle loop if in idle mode. * From the IRQ exit if in full dynticks mode. Therefore there is no need to deactivate it from the tick itself. This just just brings more overhead in the idle tick path for no reason. Signed-off-by: Frederic Weisbecker Signed-off-by: Thomas Gleixner Reviewed-by: Joel Fernandes (Google) Link: https://lore.kernel.org/r/20230912104406.312185-4-frederic@kernel.org --- kernel/time/tick-sched.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 95a8d1d..8e9a9dc 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1403,18 +1403,16 @@ static void tick_nohz_lowres_handler(struct clock_event_device *dev) tick_sched_do_timer(ts, now); tick_sched_handle(ts, regs); - if (unlikely(ts->tick_stopped)) { - /* - * The clockevent device is not reprogrammed, so change the - * clock event device to ONESHOT_STOPPED to avoid spurious - * interrupts on devices which might not be truly one shot. - */ - tick_program_event(KTIME_MAX, 1); - return; + /* + * In dynticks mode, tick reprogram is deferred: + * - to the idle task if in dynticks-idle + * - to IRQ exit if in full-dynticks. + */ + if (likely(!ts->tick_stopped)) { + hrtimer_forward(&ts->sched_timer, now, TICK_NSEC); + tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1); } - hrtimer_forward(&ts->sched_timer, now, TICK_NSEC); - tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1); } static inline void tick_nohz_activate(struct tick_sched *ts, int mode) @@ -1519,7 +1517,11 @@ static enum hrtimer_restart tick_nohz_highres_handler(struct hrtimer *timer) else ts->next_tick = 0; - /* No need to reprogram if we are in idle or full dynticks mode */ + /* + * In dynticks mode, tick reprogram is deferred: + * - to the idle task if in dynticks-idle + * - to IRQ exit if in full-dynticks. + */ if (unlikely(ts->tick_stopped)) return HRTIMER_NORESTART;