From patchwork Fri Oct 20 08:02:01 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: 155865 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp895736vqb; Fri, 20 Oct 2023 01:02:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxftjD5EKGylUhHrHS+mZ443k5PlT/8AkSXA1NcM2pkaL1NOU2sAU8N2OdbHdaksk8Uoo3 X-Received: by 2002:a17:90b:f98:b0:27d:3e90:9ee1 with SMTP id ft24-20020a17090b0f9800b0027d3e909ee1mr1283217pjb.23.1697788952210; Fri, 20 Oct 2023 01:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697788952; cv=none; d=google.com; s=arc-20160816; b=s1fm6+cGHajBIgsRFa+WQmg1FuV0IjFZUr/28pny9wQeQracbqPxHnvm9KgI0lfuWt cFTqhqrRy73y7zo+FN0Xz+vgxqdHEfmiBFZeCtNYb4CFZKA61cNpp13nk6Hfrk+JdDnD 9dDPpq23XhLiqoWFjlWDbgnhH+9n/UuHNYgYa7prgDn0OO1LwuQB8r8Q6wnyr/wrcf6n q/kk2DyeSfUHfBc0RdXx4MfoMsJzF7YiHAwkU8ES3qkdoykjkzcGPWS2onVmC0L+HVT4 FQj8wqu+mjfDMyvJAwzqScmXUuUtLIxmR7eg9hxwBrn6FzzR/+vXYHs8jlL0V6DnKAft 4dMA== 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=XBMo7rgZjOKemXx2HDqbfU2Qr3lejJI9GwbU6UPbrPA=; fh=npO1UBk2634eSE2r8XqvU8hlIJD+99ARLnmAga/U+4U=; b=ld9BbyDISp3WZ/5257XiunNWeSxv7J44NUuB/46YbqAApdJ4l1atyBaB/AeI1x29lL w9mqfqYMLRkqNTCwin/UQtJM9TdnyWpVH4An7OAtB6mGS7+apkfmTlBMNANtPIWIJ4QQ ydeayQ6WVawndRBHT6IjWIGGA/CNlqGjXRm7YCRuXCiaMVUzSilC388dSWBVcaX6tcXy c13LYV0x97j9bXLeobW8c4zcMdT0MFcK7VJ+EpvcDTeKQ/SHrXZS6tP8kcwuwlZo9TF6 FQY8bEjOaC4jnVtNq4WoZkPm4oKajCN8Mx/PS+oPWhhhxMAN6qNDWtq+EjSmEUxZl2t8 XsCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FQZpn6+N; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="wHvEWka/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id c10-20020a170902c1ca00b001ca4e2a35efsi1238344plc.45.2023.10.20.01.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 01:02:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FQZpn6+N; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="wHvEWka/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 D3F39819068F; Fri, 20 Oct 2023 01:02:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376502AbjJTICP (ORCPT + 25 others); Fri, 20 Oct 2023 04:02:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376452AbjJTICG (ORCPT ); Fri, 20 Oct 2023 04:02:06 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D64FDD55; Fri, 20 Oct 2023 01:02:03 -0700 (PDT) Date: Fri, 20 Oct 2023 08:02:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697788922; 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=XBMo7rgZjOKemXx2HDqbfU2Qr3lejJI9GwbU6UPbrPA=; b=FQZpn6+N0Tl1OafU3xH3c8/1mfGoF/YvjvLQkmYsprLZW5yvWwTALuqUdwh9OirmzdTrY1 Z9AOBeBUmrQUEgNcGfdFBVoGssit51EKZxsqa7yh2whihfz5hN4vbMReTOFCyWLdbKVxXD 0ejuC+7daaRV6e8HgmxNx45LUY5dwpQt6bsZ4nkUb/TvPj0/pcBPEtXmcSLEtwQtNOgOl2 oPlrTuK+0AZJVx3LRxMibx00TKYX9eeq3G+dCTBpRzlezE26ZD9x3KawShhoGdpO4OtKyp dPrP4L/bxBQKLL+ZQNFcxo0n1HEvGBcXhUXmQsqa2SGoJUq7VZsBzTrPLZqRhw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697788922; 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=XBMo7rgZjOKemXx2HDqbfU2Qr3lejJI9GwbU6UPbrPA=; b=wHvEWka/rOK8A4Soy/ut4gUysk8vYw5MQikk2606TgXuu6wmhL+SYC9nhHY1z6UI/FfpjK H0zX4qP7lVlJQeAw== From: "tip-bot2 for Joel Fernandes (Google)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/nohz: Update comments about NEWILB_KICK Cc: "Joel Fernandes (Google)" , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231020014031.919742-2-joel@joelfernandes.org> References: <20231020014031.919742-2-joel@joelfernandes.org> MIME-Version: 1.0 Message-ID: <169778892143.3135.5766512330437156531.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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: 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, 20 Oct 2023 01:02:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780236735958778260 X-GMAIL-MSGID: 1780260748477432988 The following commit has been merged into the sched/core branch of tip: Commit-ID: fb064e5ae1657595c090ebbc5b15787a3ef603e9 Gitweb: https://git.kernel.org/tip/fb064e5ae1657595c090ebbc5b15787a3ef603e9 Author: Joel Fernandes (Google) AuthorDate: Fri, 20 Oct 2023 01:40:27 Committer: Ingo Molnar CommitterDate: Fri, 20 Oct 2023 09:56:21 +02:00 sched/nohz: Update comments about NEWILB_KICK How ILB is triggered without IPIs is cryptic. Out of mercy for future code readers, document it in code comments. The comments are derived from a discussion with Vincent in a past review. Signed-off-by: Joel Fernandes (Google) Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20231020014031.919742-2-joel@joelfernandes.org --- kernel/sched/fair.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 9ae2208..8c486ff 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12005,8 +12005,19 @@ static bool nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle) } /* - * Check if we need to run the ILB for updating blocked load before entering - * idle state. + * Check if we need to directly run the ILB for updating blocked load before + * entering idle state. Here we run ILB directly without issuing IPIs. + * + * Note that when this function is called, the tick may not yet be stopped on + * this CPU yet. nohz.idle_cpus_mask is updated only when tick is stopped and + * cleared on the next busy tick. In other words, nohz.idle_cpus_mask updates + * don't align with CPUs enter/exit idle to avoid bottlenecks due to high idle + * entry/exit rate (usec). So it is possible that _nohz_idle_balance() is + * called from this function on (this) CPU that's not yet in the mask. That's + * OK because the goal of nohz_run_idle_balance() is to run ILB only for + * updating the blocked load of already idle CPUs without waking up one of + * those idle CPUs and outside the preempt disable / irq off phase of the local + * cpu about to enter idle, because it can take a long time. */ void nohz_run_idle_balance(int cpu) {