Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7856287rwb; Tue, 6 Dec 2022 10:40:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Yufmr0miUn7uZBfh+p9unoeWKknVL1OE/65vjyZBxwtKebVvXbeVeGD2jp4SOPDxdo/XA X-Received: by 2002:a17:902:cecb:b0:17f:628d:2a8 with SMTP id d11-20020a170902cecb00b0017f628d02a8mr81986266plg.34.1670352038907; Tue, 06 Dec 2022 10:40:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670352038; cv=none; d=google.com; s=arc-20160816; b=VlbgOau5dgm/67F9/RAYH70iSuCo+9kzDxVSdFjMbLaMX6EXPhTBqnD35dUeqlVPNH MxscKwOjB8hxcEPvEk/OX2c9RJUJobvJnoFMQfZIQzgIZhmsBUfDVzjr81vGaVuy9TDT +jHBEN5JOYPCxJq3O2DoOjIySKetA57Th4b2TlJk7Fzc+ht4UU58ahACTmLkRpfIBwx9 I0GwEalEhiMKDSbWW0T7/yeLntmEaYapqx+wTbqA7y7unvHFwl9WeOpsn883Wx53pad6 8JeJ8llntA+5VpeqUIRyUgN0njhmDXsfkJRN0EkKI09a5ZNj074IqPVEqxczC2wwVcB9 ZGRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=uTwaarv/RfkMTIKOeM2lQjF8kS3En5ZCRBFqFxqtgzY=; b=CUiXk8xhTAKQP3xTXsxtybC5y/+PB1y7PRXQ3Obbhw7azrdQqWWn0rWcGohsOBtbvs PiVKGkzTCY85IYoST7W3o+J2u1k6fxZtMhvlQhW+qC0qgTViUTds2c4t0/po55n7nQNu dJbqN0FrjExSoEMRN9t/MHSYsXNZE5ZKopR7HP/ErBUzMKTGKVzMDCMMWUyQCx6FtQXU cnFuihHcK5uRRVKF5XLk3gdTA87RXr28O5jQQwQqttjsR4/+4D0QQRTIGfqn9F/s0g9/ jmtKyCfd1XzA1iagwcXzOZBFO1+bsY12bu3AczVJY96jSou63MWTA2VJ06nIYdLpYO++ 9buw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oc7-20020a17090b1c0700b0020de23fa58csi22720181pjb.12.2022.12.06.10.40.28; Tue, 06 Dec 2022 10:40:38 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229642AbiLFSD4 (ORCPT + 77 others); Tue, 6 Dec 2022 13:03:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbiLFSDx (ORCPT ); Tue, 6 Dec 2022 13:03:53 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C2B3C2EF75 for ; Tue, 6 Dec 2022 10:03:51 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 436D223A; Tue, 6 Dec 2022 10:03:58 -0800 (PST) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DFBF13F73B; Tue, 6 Dec 2022 10:03:48 -0800 (PST) Message-ID: <75ba5884-63c0-5180-00b8-e9764306a83e@arm.com> Date: Tue, 6 Dec 2022 19:03:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2 4/7] sched/fair: Introduce sched_smt_siblings_idle() Content-Language: en-US To: Ricardo Neri , "Peter Zijlstra (Intel)" , Juri Lelli , Vincent Guittot Cc: Ricardo Neri , "Ravi V. Shankar" , Ben Segall , Daniel Bristot de Oliveira , Len Brown , Mel Gorman , "Rafael J. Wysocki" , Srinivas Pandruvada , Steven Rostedt , Tim Chen , Valentin Schneider , x86@kernel.org, linux-kernel@vger.kernel.org, "Tim C . Chen" References: <20221122203532.15013-1-ricardo.neri-calderon@linux.intel.com> <20221122203532.15013-5-ricardo.neri-calderon@linux.intel.com> From: Dietmar Eggemann In-Reply-To: <20221122203532.15013-5-ricardo.neri-calderon@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 On 22/11/2022 21:35, Ricardo Neri wrote: > Architectures that implement arch_asym_cpu_priority() may need to know the > idle state of the SMT siblings of a CPU. The scheduler has this information > and functionality. Expose it. > > Move the existing functionality outside of the NUMA code. [...] > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 0e4251f83807..9517c48df50e 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -1052,6 +1052,28 @@ update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se) > * Scheduling class queueing methods: > */ > > +static inline bool is_core_idle(int cpu) > +{ > +#ifdef CONFIG_SCHED_SMT > + int sibling; > + > + for_each_cpu(sibling, cpu_smt_mask(cpu)) { > + if (cpu == sibling) > + continue; > + > + if (!idle_cpu(sibling)) > + return false; > + } > +#endif > + > + return true; > +} > + > +bool sched_smt_siblings_idle(int cpu) > +{ > + return is_core_idle(cpu); > +} Nitpick: Can we not just have one exported function for both use-cases: NUMA and x86 ITMT? [...]