From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7719C352A1 for ; Tue, 6 Dec 2022 18:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbiLFSD6 (ORCPT ); Tue, 6 Dec 2022 13:03:58 -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 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? [...]