From patchwork Mon Oct 9 10:26:11 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: 149924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1768959vqo; Mon, 9 Oct 2023 03:26:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHis8+DJUXs1dpr1BoMrWgiewgSADL5eqJBBafYPRsmO7JmY3gPGv1bDErYcyS+L6KDaD+W X-Received: by 2002:a05:6a20:4292:b0:157:1b5:61ce with SMTP id o18-20020a056a20429200b0015701b561cemr19284767pzj.4.1696847213413; Mon, 09 Oct 2023 03:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696847213; cv=none; d=google.com; s=arc-20160816; b=inGOHVMydv/FemoO6CNKsVtm5+KyKpCy3fSey56IxZQ1kxnTJbFj2VeZGwOrd/6mih PVY8/AmFsIkvgrSSNjUaX88bakxVuLQMsOp+krf6+rNkP2ehhHblEaIMcPI36NZRhqx6 VVpa41YvbSDfWrSm66LgHE6czGpgpiyz6XxIbbZfXbpcj1fYpnv7eiZkZUUpWwMp9xnq oULQuRopneccf87+h1CWRwmkBkiwpBa9lk1SAv7lB7BsGZAVCb4G0NqVW1YEd2qz+BxM FgKkjbsiDLCh+f0O7QaB89D/eS4Mn2yTGa/HHXjaY2+iTJgNGV3DkIxVkHTnBmFic1t3 VeWA== 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=vrLEqPl6gk4LRSSeKr3UyEVVQOqyZX8dfC8LmvBOxj4=; fh=98PO9cUXyB5KzM7iQQrkqvLNVc4QFHsO4opbmVeOgeo=; b=Xn1mQoLyTSArUBp06Cw8I+g7S2TJeqpEMgU8keiZclD3+/V5OjlZTerI3+eKy9+UBo 2Ij/1ozLacI56mNbEdxAig2rZ+/81opVYFlbbZAPb29KQpP66kgyqVGv+t7v5hRdgVEA 3BZMvfWvxDr15E3zdorux9uhBdJYqgvzWKcmD0LIAMRVBMKpWWYqpUFK9FZSxyKyS9Yg joyHkfqqIW30SvgNlskMQ8dJkWxEB9T9PcJ5zPF5EjcBJIbudoLah4NUSK9zbBrKr2pD F6PnhwaD4/OY622ahuV5GGTkmFAEUXP8E7MSJQY8Zu/gaZoAGwsU1yNlK2D5XO/H/dcT cYmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VFXDLDhZ; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b00577646e2b6bsi3309461pgb.206.2023.10.09.03.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 03:26:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VFXDLDhZ; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 BB31A8069DB2; Mon, 9 Oct 2023 03:26:33 -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 S1345731AbjJIK0U (ORCPT + 18 others); Mon, 9 Oct 2023 06:26:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345615AbjJIK0Q (ORCPT ); Mon, 9 Oct 2023 06:26:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B886A9D; Mon, 9 Oct 2023 03:26:13 -0700 (PDT) Date: Mon, 09 Oct 2023 10:26:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696847172; 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=vrLEqPl6gk4LRSSeKr3UyEVVQOqyZX8dfC8LmvBOxj4=; b=VFXDLDhZ+vmfeKMyUG0c975KoujXKrNya4d0lsIif4QmHl+YNIiw9IkB8oL0ICtyvkg1aG ZLPMRpsy8SZ5DXkRDs/p1lKnBNpAx+3erHgAkfbw9505+LF+VBoRS+cSPVoV/TEF9b+hG7 GncqI2xSDB6FdnBnyg7lrPVLiT6KcyBxYYMM4HpG42pVg6eV6dO5aczL7eH7UhKIfdQnXy SMusEza9E2jAhcrsQSA5sWjP0YzPaI2WIRZxiTbkzGue7mlq1veLAcu28eU4cPNwl++M2C 4bFR3tuqV6bj8b10ddiFQ2cHNNvk0m/a+fhfspcPIrRZ876AwS1lexg8TcrO7g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696847172; 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=vrLEqPl6gk4LRSSeKr3UyEVVQOqyZX8dfC8LmvBOxj4=; b=ORhAzzM7z79cy5CpYWAbJTP1U6JlBJzcRRn7/d2bZsn5nufg6DEXN7RPSPEKyWZlNI9YPc 9q0I+s6AlHFHLZCw== From: "tip-bot2 for Ingo Molnar" 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 idle load-balancing (ILB) comments Cc: Ingo Molnar , "Joel Fernandes (Google)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231006102518.2452758-2-mingo@kernel.org> References: <20231006102518.2452758-2-mingo@kernel.org> MIME-Version: 1.0 Message-ID: <169684717152.3135.18417702830973056064.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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]); Mon, 09 Oct 2023 03:26:33 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779001395229480234 X-GMAIL-MSGID: 1779273263646963430 The following commit has been merged into the sched/core branch of tip: Commit-ID: 7ef7145a2b26b172ac6885c4cf3272a38bc0979a Gitweb: https://git.kernel.org/tip/7ef7145a2b26b172ac6885c4cf3272a38bc0979a Author: Ingo Molnar AuthorDate: Fri, 06 Oct 2023 12:25:16 +02:00 Committer: Ingo Molnar CommitterDate: Mon, 09 Oct 2023 12:21:23 +02:00 sched/nohz: Update idle load-balancing (ILB) comments - Fix incorrect/misleading comments, - clarify some others, - fix typos & grammar, - and use more consistent style throughout. Signed-off-by: Ingo Molnar Reviewed-by: Joel Fernandes (Google) Link: https://lore.kernel.org/r/20231006102518.2452758-2-mingo@kernel.org --- kernel/sched/fair.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 52c498f..2b63a14 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11503,14 +11503,15 @@ static inline int on_null_domain(struct rq *rq) #ifdef CONFIG_NO_HZ_COMMON /* - * idle load balancing details - * - When one of the busy CPUs notice that there may be an idle rebalancing + * NOHZ idle load balancing (ILB) details: + * + * - When one of the busy CPUs notices that there may be an idle rebalancing * needed, they will kick the idle load balancer, which then does idle * load balancing for all the idle CPUs. - * - HK_TYPE_MISC CPUs are used for this task, because HK_TYPE_SCHED not set + * + * - HK_TYPE_MISC CPUs are used for this task, because HK_TYPE_SCHED is not set * anywhere yet. */ - static inline int find_new_ilb(void) { int ilb; @@ -11531,8 +11532,10 @@ static inline int find_new_ilb(void) } /* - * Kick a CPU to do the nohz balancing, if it is time for it. We pick any - * idle CPU in the HK_TYPE_MISC housekeeping set (if there is one). + * Kick a CPU to do the NOHZ balancing, if it is time for it, via a cross-CPU + * SMP function call (IPI). + * + * We pick the first idle CPU in the HK_TYPE_MISC housekeeping set (if there is one). */ static void kick_ilb(unsigned int flags) { @@ -11560,7 +11563,7 @@ static void kick_ilb(unsigned int flags) /* * This way we generate an IPI on the target CPU which - * is idle. And the softirq performing nohz idle load balance + * is idle, and the softirq performing NOHZ idle load balancing * will be run before returning from the IPI. */ smp_call_function_single_async(ilb_cpu, &cpu_rq(ilb_cpu)->nohz_csd); @@ -11589,7 +11592,7 @@ static void nohz_balancer_kick(struct rq *rq) /* * None are in tickless mode and hence no need for NOHZ idle load - * balancing. + * balancing: */ if (likely(!atomic_read(&nohz.nr_cpus))) return; @@ -11611,9 +11614,8 @@ static void nohz_balancer_kick(struct rq *rq) sd = rcu_dereference(rq->sd); if (sd) { /* - * If there's a CFS task and the current CPU has reduced - * capacity; kick the ILB to see if there's a better CPU to run - * on. + * If there's a runnable CFS task and the current CPU has reduced + * capacity, kick the ILB to see if there's a better CPU to run on: */ if (rq->cfs.h_nr_running >= 1 && check_cpu_capacity(rq, sd)) { flags = NOHZ_STATS_KICK | NOHZ_BALANCE_KICK; @@ -11665,11 +11667,11 @@ static void nohz_balancer_kick(struct rq *rq) if (sds) { /* * If there is an imbalance between LLC domains (IOW we could - * increase the overall cache use), we need some less-loaded LLC - * domain to pull some load. Likewise, we may need to spread + * increase the overall cache utilization), we need a less-loaded LLC + * domain to pull some load from. Likewise, we may need to spread * load within the current LLC domain (e.g. packed SMT cores but * other CPUs are idle). We can't really know from here how busy - * the others are - so just get a nohz balance going if it looks + * the others are - so just get a NOHZ balance going if it looks * like this LLC domain has tasks we could move. */ nr_busy = atomic_read(&sds->nr_busy_cpus);