From patchwork Wed Dec 20 15:59:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 181725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2747537dyi; Wed, 20 Dec 2023 08:09:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBZuuo75XmuA+ipKDQtrUuc7afl0AaIFv4mYxXr7EfQ6cBZV3L1Js2d29ZxRbNwHiZfgPW X-Received: by 2002:a17:902:fc8e:b0:1d3:fbf6:4d94 with SMTP id mf14-20020a170902fc8e00b001d3fbf64d94mr328006plb.75.1703088575754; Wed, 20 Dec 2023 08:09:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703088575; cv=none; d=google.com; s=arc-20160816; b=oMM6a6qgDmZzQ0kIJvEhyv5c27BmsXtLAbL+tTNqu8v4hIz4BpyMV+Aql+lKxMX1Qf giQG3V6/2M0gQuB5kW+qj3yr+FSw2w5unCVZ54Bp1zdTUm2x0YLtT1HwOy+ZHk7HOJgw vqGRkGLngDefSbYM/uwQKCZEpg3/iw37wcS8TlI0ppOXBi/o076y3Ksb2t5G6EaXED60 fTMDzi+urwepoEFW0Ez/rTybaeT5qcQdUnL1YCcGsqqlXRIn2s0/aKpR2oIjZJstx1SN fREQKazWTBWkuOOSr/86RuMvUCW0hmUr+Ez1bsP50+VA1ejrRdoPskemp2Js1cSRemAG NdBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=eFMhP5Pq/AnRa8JX1yrq4gn/rIWOr9VQX/CzZB6IeTg=; fh=IdquJyaazQ3wXWxdOExnpctJRLX4Jw3HEb/tnyKonzY=; b=Q65ZX5xJgm5IwfyfYoLKQDFjAPJaXzCcpoWb66uLSECL5z2d9vLEIjP9O7mEKsVTW8 0Vdk94uiq5tKTNZYmabJ55cViHOqQXentE9IFnsDZLIQHnNXdBojGCpzgulKZxdxO9C+ ljTfSHsXVsg+U+PHSqfaNcfdqHNlU2poy/jLgqYeITLcLMLU7BXnrqsiRrBQ5jipl7Ga Zf+oysdLLNw2iYNWj2ZosZmAmdq2ExTgfTQqdQ4GU4FBM3cBahpXaMzAvDrf54EVUAfm C9xxP+DAAQ9nJ92cyHR8J3hK/Er2JXAqMJRr1A4vRjGTRDBFSm4724D0ylmMem68quFy Z0Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=OVPxWxRZ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-7231-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7231-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p20-20020a170902ead400b001d3ef794a1fsi1231397pld.465.2023.12.20.08.09.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 08:09:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7231-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=OVPxWxRZ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-7231-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7231-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E7B63B26FA2 for ; Wed, 20 Dec 2023 16:02:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DC764AF64; Wed, 20 Dec 2023 15:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OVPxWxRZ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="r4c5PdOZ" X-Original-To: linux-kernel@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBC7A48792; Wed, 20 Dec 2023 15:59:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 20 Dec 2023 15:59:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1703087950; 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=eFMhP5Pq/AnRa8JX1yrq4gn/rIWOr9VQX/CzZB6IeTg=; b=OVPxWxRZNxSffzI7CPL37jtS5VYHP8PsED1M8vlQl/rQmV4RqQYBMsdg2O5DE0XW01yfuJ xLOrBgvyW2p6UQzEjvR+0ykYFklCmMIJ1o6ykb12XLy3mClLOJMjTpGFvOHnkdiCNPZTSS c6TuVK2d4xbdC6SXlgW2l9ajJ0VxdAtfLl72h6H2D/zv4DKK69V+xmlkuOsZMt2Ho5hrDL 48f5S5D9pBYaMCCgr2WQivNsvFfEqgOFPLthuQBQ6j9HLK2Aa/rS9rwvZ8PgnpHEpRxuZr YW5vXhNrEyy+kGLGDhzXyBT5iMT3xaHK1RQYJ/bc7832DsPMF7QMNo9pQ7jYIw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703087950; 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=eFMhP5Pq/AnRa8JX1yrq4gn/rIWOr9VQX/CzZB6IeTg=; b=r4c5PdOZnXUahouPM5yF6fNYvVWB1kKX3Ghm1H2XH+ygbbc9W/MMoxl9lnWIYYhzo2yxJF xUUzOrA2TWwhaiCA== From: "tip-bot2 for Anna-Maria Behnsen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] timers: Do not IPI for deferrable timers Cc: "Anna-Maria Behnsen" , Thomas Gleixner , Frederic Weisbecker , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231201092654.34614-7-anna-maria@linutronix.de> References: <20231201092654.34614-7-anna-maria@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170308794956.398.15756777803011185741.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784071176682938173 X-GMAIL-MSGID: 1785817806171113900 The following commit has been merged into the timers/core branch of tip: Commit-ID: d124c3393e798b1fb142ee728d5c8976d11e722d Gitweb: https://git.kernel.org/tip/d124c3393e798b1fb142ee728d5c8976d11e722d Author: Anna-Maria Behnsen AuthorDate: Fri, 01 Dec 2023 10:26:28 +01:00 Committer: Thomas Gleixner CommitterDate: Wed, 20 Dec 2023 16:49:38 +01:00 timers: Do not IPI for deferrable timers Deferrable timers do not prevent CPU from going idle and are not taken into account on idle path. Sending an IPI to a remote CPU when a new first deferrable timer was enqueued will wake up the remote CPU but nothing will be done regarding the deferrable timers. Drop IPI completely when a new first deferrable timer was enqueued. Signed-off-by: Anna-Maria Behnsen Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker Link: https://lore.kernel.org/r/20231201092654.34614-7-anna-maria@linutronix.de --- kernel/time/timer.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index ed8d606..9188205 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -571,18 +571,15 @@ static int calc_wheel_index(unsigned long expires, unsigned long clk, static void trigger_dyntick_cpu(struct timer_base *base, struct timer_list *timer) { - if (!is_timers_nohz_active()) - return; - /* - * TODO: This wants some optimizing similar to the code below, but we - * will do that when we switch from push to pull for deferrable timers. + * Deferrable timers do not prevent the CPU from entering dynticks and + * are not taken into account on the idle/nohz_full path. An IPI when a + * new deferrable timer is enqueued will wake up the remote CPU but + * nothing will be done with the deferrable timer base. Therefore skip + * the remote IPI for deferrable timers completely. */ - if (timer->flags & TIMER_DEFERRABLE) { - if (tick_nohz_full_cpu(base->cpu)) - wake_up_nohz_cpu(base->cpu); + if (!is_timers_nohz_active() || timer->flags & TIMER_DEFERRABLE) return; - } /* * We might have to IPI the remote CPU if the base is idle and the