Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7314928rwr; Wed, 10 May 2023 06:50:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66+hXP3V9T0HpqVAeclp2WWjMHVmmnA3gJ7Znaw7z9iHWE+2muiDYESbWeUHBGWIeu133A X-Received: by 2002:a17:902:cec2:b0:1a8:1f41:59ba with SMTP id d2-20020a170902cec200b001a81f4159bamr21378541plg.38.1683726658318; Wed, 10 May 2023 06:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683726658; cv=none; d=google.com; s=arc-20160816; b=cagxRJdCp8GyqboKRqS5HvjchBjG1fn9hUqfInWYvECV4b+/2pMws2nPcVxE+CTFUE gvCsIY0g+QkWIeM+WZWrgUpEGaXOluZY5OioGgkpZihQSwOJMWmQOJumqMA+YMF/YlNr o0GysV+Gt2DuspydmOXvaZ3T7nS37YtyfcXwJ2g3dms9GGq27PGyA5HvX/+NWU7PgVri UHPr1LVXK6D5WnWCAuwL+bEaAo0ABG1iQrKIYZGx6S3tOBcfqN+yUWU2C3VZxYuAVkn7 5xLNKIeys/eQtMPRXDwyDuxpdc0pdzcZV7aP3fUzrlslgYLnPT0E+39FZJvGWiqMWLQO 4Vig== 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=daQbWBn3z/bvLFEar+JNX4QlqkiGxgGZ2GC2wZDBP28=; b=gAlnpiBiu3zUpMyQfDo/6GiuAGTbf0dw5TScETu/2vZL1tjiuL7AtL8fb40/qrE6/Z Il6xNgDVmtEL9JhN17oo8v0oPDSS3zA5lzctjcuNgIVJbTntZNmcqjY7JfqJ4o48al+Z v1i6XX78lMlsgV81JZrmvb5bJp7WFvN9huKC/m8sAI8Zia1VugLT8Ab3kn8FkzaR4hL3 ba3EkaNVLVfUu0/B2BlQDv7bq4ti+TszHaCVmLSvKmgIJF0h32xJK3UgJRxiEZWEtLmP gvYC9mSohbm1N2UIhwkl4utpcGHbjG/ceZ4xpTgyKB/S1v/pEIVo4j8CohP5Zr73ItHe 5tHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KCPxjakp; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a17090282c500b001a96b56099bsi4119545plz.356.2023.05.10.06.50.45; Wed, 10 May 2023 06:50:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KCPxjakp; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237339AbjEJNtq (ORCPT + 99 others); Wed, 10 May 2023 09:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237272AbjEJNtX (ORCPT ); Wed, 10 May 2023 09:49:23 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E82D7D96; Wed, 10 May 2023 06:49:19 -0700 (PDT) Date: Wed, 10 May 2023 13:49:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683726552; 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=daQbWBn3z/bvLFEar+JNX4QlqkiGxgGZ2GC2wZDBP28=; b=KCPxjakpb1DTXH5KU3uqYR8/XSkWM2tuIn9yfutd+3eAdfqC2ZcFTuP7FzDtP4J5E3l2mI 9hNBfbOlk5WN2yfVAL3rCpFR8Zq83VuprtiM6SGsE5kTQUCYs2BUtFi2KpP9iTRwXu9X9P +mKlfgFDDZRlNdXVcXrOV/Q8bzYhZpYAvoh1uyAZHAKU3s1rTl7vLKPoLSCzG/+kO478fz rlM7F3ik9yaN/8hPr5MmBI/kJvu4UGsnuvOWvTldMMa2d0r7nhbLRnnDUOpPQiMacN3jGu 7YiHggxw14ZvSQWd3jTeMdJjyBxpYbxIcYDhKI1UhMih40JkEToUUgTfaJPULQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683726552; 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=daQbWBn3z/bvLFEar+JNX4QlqkiGxgGZ2GC2wZDBP28=; b=1Nj8HBSJfrBJuU2UTNJp2flUKQ8sxOdyQ2Cv4ddPB2jbLBFYfVCZyVIDAd2m7Hiu/0Pcpd NNUJu6SAv+x/N5DQ== From: "tip-bot2 for Ricardo Neri" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/topology: Check SDF_SHARED_CHILD in highest_flag_domain() Cc: Ionela Voinescu , Ricardo Neri , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230406203148.19182-9-ricardo.neri-calderon@linux.intel.com> References: <20230406203148.19182-9-ricardo.neri-calderon@linux.intel.com> MIME-Version: 1.0 Message-ID: <168372655213.404.5276333289857461855.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=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 The following commit has been merged into the sched/core branch of tip: Commit-ID: 40b4d3dc328265c8ec6688657d74813edf785c83 Gitweb: https://git.kernel.org/tip/40b4d3dc328265c8ec6688657d74813edf785c83 Author: Ricardo Neri AuthorDate: Thu, 06 Apr 2023 13:31:44 -07:00 Committer: Peter Zijlstra CommitterDate: Mon, 08 May 2023 10:58:36 +02:00 sched/topology: Check SDF_SHARED_CHILD in highest_flag_domain() Do not assume that all the children of a scheduling domain have a given flag. Check whether it has the SDF_SHARED_CHILD meta flag. Suggested-by: Ionela Voinescu Signed-off-by: Ricardo Neri Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20230406203148.19182-9-ricardo.neri-calderon@linux.intel.com --- kernel/sched/sched.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index ec7b3e0..6784462 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1772,6 +1772,13 @@ queue_balance_callback(struct rq *rq, for (__sd = rcu_dereference_check_sched_domain(cpu_rq(cpu)->sd); \ __sd; __sd = __sd->parent) +/* A mask of all the SD flags that have the SDF_SHARED_CHILD metaflag */ +#define SD_FLAG(name, mflags) (name * !!((mflags) & SDF_SHARED_CHILD)) | +static const unsigned int SD_SHARED_CHILD_MASK = +#include +0; +#undef SD_FLAG + /** * highest_flag_domain - Return highest sched_domain containing flag. * @cpu: The CPU whose highest level of sched domain is to @@ -1779,16 +1786,25 @@ queue_balance_callback(struct rq *rq, * @flag: The flag to check for the highest sched_domain * for the given CPU. * - * Returns the highest sched_domain of a CPU which contains the given flag. + * Returns the highest sched_domain of a CPU which contains @flag. If @flag has + * the SDF_SHARED_CHILD metaflag, all the children domains also have @flag. */ static inline struct sched_domain *highest_flag_domain(int cpu, int flag) { struct sched_domain *sd, *hsd = NULL; for_each_domain(cpu, sd) { - if (!(sd->flags & flag)) + if (sd->flags & flag) { + hsd = sd; + continue; + } + + /* + * Stop the search if @flag is known to be shared at lower + * levels. It will not be found further up. + */ + if (flag & SD_SHARED_CHILD_MASK) break; - hsd = sd; } return hsd;