Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp729677rdb; Thu, 19 Oct 2023 18:41:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOy3OTwhwzpAtuPM6pDuOXKESoEtzK9N5n4GkbiXxMcpvDew0YFGBgWjR0OivhdTa+b+fy X-Received: by 2002:a17:90b:1189:b0:27d:10b1:5deb with SMTP id gk9-20020a17090b118900b0027d10b15debmr580819pjb.31.1697766063809; Thu, 19 Oct 2023 18:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697766063; cv=none; d=google.com; s=arc-20160816; b=BMoWJKt4nM+y4812yW4LKzZBc4dFK9eaNpVBVtZdCSDWFNsxWA3+ie0oJzGN8NO6Y/ 4UhSEjfFrrWYO/JMm7ldKLmOllhIwscNP71x5+5FnBPw59eHqHP05wQQfAo8yXexzqhm GHXGNOyINasVvKcDbPLDgwpQAbumQjd4ygschpd1s5DabEulpIAbnEVyg/LGR20Mrc3S LwUNm21eXi8uw3b8/VTLC0h7xFqlXarnGbv072UHQDl1VNAkgqXj2K8XhkMSrvFjiBv1 ofqzqBiIbwYBkkr8ZevSqA+fdzLlbyEQL5FytNHi+xzGowXTkmNL2FOT3ASmLn/98/5g mJXg== 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:from :dkim-signature; bh=yh5be8dZ5dcoT5J8JNwZ13KMhHHmnbemy0aycAzw2qI=; fh=nnfH2AC1mT31g9MWQ7pNPr5F+2lLf+9flBau2HM0dhA=; b=gyvpRGY1WnP6Zk16Pu4YYpfR6jldbLrjU0HCjw8YxquEi6U3YRwvr5kWiRo4zf8YL4 Jwogn874vZBQsTO8UsYkW43HJSMR+oiJNlUgFCUstW3eybkDN7GLZ39bONL0Yays6URE xmpkSqLKAdQ/fjjakyWZmqOht715qeTxbshBVs0j1pgLyKcqnixbE2x+LZjLl4csMgse Udw4VvgsZ0L5CGvnF0RFagF7CQ3d+hUno4aJv1eRic9zSPTmfUYg7HvrmDkOoS9c/NBO 0d/jkoK23TnE9fKA7UXLyC6EygIYPpXiJaWajYepCr+1/Jdlfpw1v+ontheWEmd11rbC E5Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=xI8wf3N3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id ml15-20020a17090b360f00b0027d1326d6c3si769208pjb.121.2023.10.19.18.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 18:41:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=xI8wf3N3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5370783700F2; Thu, 19 Oct 2023 18:40:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346810AbjJTBkq (ORCPT + 99 others); Thu, 19 Oct 2023 21:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346780AbjJTBkp (ORCPT ); Thu, 19 Oct 2023 21:40:45 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9715B119 for ; Thu, 19 Oct 2023 18:40:43 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-3576121362eso1110585ab.1 for ; Thu, 19 Oct 2023 18:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1697766042; x=1698370842; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yh5be8dZ5dcoT5J8JNwZ13KMhHHmnbemy0aycAzw2qI=; b=xI8wf3N3hDb622ncSnja0fIzG4grMTp1OelEPRX/VWHTlYsXObTrqplI9Si8vKbNb2 fJ0/H2vY6x/HC3wa7wxl2aL34cX77rVBEumY+/pSODy+Pz0x61HB35AsDTuqSxeEW31/ x3WUqUvOaIAWwPalQFXGemCB69C9LloMlhg5s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697766042; x=1698370842; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yh5be8dZ5dcoT5J8JNwZ13KMhHHmnbemy0aycAzw2qI=; b=U+d1ClX5+GddiNTQ+1PAGLF53zYC6F6NWuOrtFO4Xe1dtokUfGDqn0x8OlZYBo+YX1 OI0PrcBMTgnyeqwb6DE//NrmvQ8QQpMtjbWtGgKyISvpHwceFU0TPyaUgceZY2kjtr6+ RA1E3D9NXGps4v7BL4ve9svkXH4p6vJkNdknmuI5MQhtA5gaX+MINM9gu4Wfg5Uj9PIT x44JRcOK3VB6U8qIbH1PrZ9jPHrwV8etHpU7t2+wRUIOv3o2aZz74k2KRhxIOGZlT+lT G0QzlAHHzRnO39gpSHNOK9rF/E9L/zNAGVKAgzp+RP37T9+88yA/HZlA5JuOnU5AcGSu Z5dw== X-Gm-Message-State: AOJu0YxdCsyyD88RxDhHaRo0wNbFEeWvOBlDfPNCpkSJJlFSR1w7m6SH Tjh5sGoeX7iyL9IUYWwYEy0yLZ6740IauWkikQtKSA== X-Received: by 2002:a92:cb41:0:b0:357:a3fb:1a81 with SMTP id f1-20020a92cb41000000b00357a3fb1a81mr682373ilq.21.1697766042597; Thu, 19 Oct 2023 18:40:42 -0700 (PDT) Received: from joelboxx5.c.googlers.com.com (20.10.132.34.bc.googleusercontent.com. [34.132.10.20]) by smtp.gmail.com with ESMTPSA id h9-20020a056e020d4900b00350f5584876sm270394ilj.27.2023.10.19.18.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 18:40:42 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Cc: "Joel Fernandes (Google)" , Suleiman Souhlal , Frederic Weisbecker , "Paul E . McKenney" Subject: [PATCH 2/3] sched/nohz: Update comments about NEWILB_KICK Date: Fri, 20 Oct 2023 01:40:27 +0000 Message-ID: <20231020014031.919742-2-joel@joelfernandes.org> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog In-Reply-To: <20231020014031.919742-1-joel@joelfernandes.org> References: <20231020014031.919742-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 fry.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 (fry.vger.email [0.0.0.0]); Thu, 19 Oct 2023 18:40:59 -0700 (PDT) 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. Cc: Suleiman Souhlal Cc: Steven Rostedt Cc: Frederic Weisbecker Cc: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- 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 965c30fbbe5c..8e276d12c3cb 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11959,8 +11959,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) { -- 2.42.0.655.g421f12c284-goog