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 8541AC636D4 for ; Mon, 13 Feb 2023 12:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbjBMMoh (ORCPT ); Mon, 13 Feb 2023 07:44:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbjBMMof (ORCPT ); Mon, 13 Feb 2023 07:44:35 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 790BD5FE6 for ; Mon, 13 Feb 2023 04:44:34 -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 C703C4B3; Mon, 13 Feb 2023 04:45:16 -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 BBAE83F703; Mon, 13 Feb 2023 04:44:29 -0800 (PST) Message-ID: Date: Mon, 13 Feb 2023 13:44:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v3 07/10] sched/fair: Do not even the number of busy CPUs via asym_packing 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 , Ionela Voinescu , x86@kernel.org, linux-kernel@vger.kernel.org, "Tim C . Chen" References: <20230207045838.11243-1-ricardo.neri-calderon@linux.intel.com> <20230207045838.11243-8-ricardo.neri-calderon@linux.intel.com> From: Dietmar Eggemann In-Reply-To: <20230207045838.11243-8-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 07/02/2023 05:58, Ricardo Neri wrote: [...] > @@ -9269,33 +9264,11 @@ static bool asym_smt_can_pull_tasks(int dst_cpu, struct sd_lb_stats *sds, > struct sched_group *sg) > { > #ifdef CONFIG_SCHED_SMT > - bool local_is_smt; > int sg_busy_cpus; > > - local_is_smt = sds->local->flags & SD_SHARE_CPUCAPACITY; > sg_busy_cpus = sgs->group_weight - sgs->idle_cpus; > > - if (!local_is_smt) { > - /* > - * If we are here, @dst_cpu is idle and does not have SMT > - * siblings. Pull tasks if candidate group has two or more > - * busy CPUs. > - */ > - if (sg_busy_cpus >= 2) /* implies sg_is_smt */ > - return true; > - > - /* > - * @dst_cpu does not have SMT siblings. @sg may have SMT > - * siblings and only one is busy. In such case, @dst_cpu > - * can help if it has higher priority and is idle (i.e., > - * it has no running tasks). > - */ > - return sched_asym_prefer(dst_cpu, sg->asym_prefer_cpu); > - } > - > /* > - * @dst_cpu has SMT siblings and are also idle. > - * > * If the difference in the number of busy CPUs is two or more, let > * find_busiest_group() take care of it. We only care if @sg has > * exactly one busy CPU. This covers SMT and non-SMT sched groups. Can't this be made lighter by removing asym_smt_can_pull_tasks() and putting the logic to exclude the call to sched_asym_prefer() into sched_asym() directly? Not sure if we need the CONFIG_SCHED_SMT since it's all guarded by `flags & SD_SHARE_CPUCAPACITY` already, which is only set under. CONFIG_SCHED_SMT. static inline bool sched_asym(struct lb_env *env, struct sd_lb_stats *sds, struct sg_lb_stats *sgs, struct sched_group *group) { bool local_is_smt = sds->local->flags & SD_SHARE_CPUCAPACITY; if (local_is_smt && !is_core_idle(env->dst_cpu)) return false; if ((local_is_smt || group->flags & SD_SHARE_CPUCAPACITY)) { int sg_busy_cpus = sgs->group_weight - sgs->idle_cpus; if (sg_busy_cpus != 1) return false; } return sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu); } [...]