Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp579955imm; Wed, 29 Aug 2018 07:11:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY+xFCYlIvL270q2d/a/xKSijnq7A5/OWbsf0j80ACxPDvJAWRd6Ib0OEFJnxbPkGNqqzv5 X-Received: by 2002:aa7:8591:: with SMTP id w17-v6mr6233672pfn.77.1535551863523; Wed, 29 Aug 2018 07:11:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535551863; cv=none; d=google.com; s=arc-20160816; b=xmbhF27OD5rC7h0J3AifWwIoUDxhU7zZ3zd8Btq/EiR7gVwnCKgMll6oHu1jjDENUH G/7lC0HWiidln8gVTX3QnCy0c/mOdDdKG1L/t5xW2DgCpjsduegvucx6cVqN/MK6xUHI fJrkOq1Mqgb8HVIjN5ofQuNmfAaw4CfTCTfs1TYvTafE+n1EttVKbKaTM5M0bDtqoQbl WpTMIdpRFPtKYDbPfBNzf68TqG7f20fos9JEP9N3/7HjJUF83S/nY0mzPmJAis97ISp8 uprg4+t0JvXBZhqSW+/g7ok4EOmUkSI5BZbRjtu4re/Pznx2eNxdZ463xZlWoc79EOrC tyxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:arc-authentication-results; bh=8x8JOH/145/xnbFvVN9Jsqry4Q0DUs8NIdMk6cM0XKE=; b=GqTPrAyMN6JM1abNVCInjT4hbGhBhgxsRkPMQ2hUX/ear3SW4LkwZidUHP6e4dfdKE yD/alMxOiGCudm33VkYVB384lTnuRDc6vCyP8NCndghJcaEpuP4vsr884ypZ2Myi82j2 /qQ07egRxDYGjcy2K0oM+jBCV/J/cF+pQqj0PDC0iUhPLc9epDDI2qMY6VNcOgEKMnIb VlrAlaJjTOs64s1F9YFPaPx0r9bz5w6+oC/OpXGTs9V36QP//iZ7ySeiTdaJlUt828vl RyfD6noUlGP/X7g43daTtkYlSbJ7Z5sBf3tczikxIdqtNXQTS/QpKjIf/pI9SUSNDbuG d8AQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16-v6si3975898pga.104.2018.08.29.07.10.48; Wed, 29 Aug 2018 07:11:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728870AbeH2SFs (ORCPT + 99 others); Wed, 29 Aug 2018 14:05:48 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55372 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727316AbeH2SFs (ORCPT ); Wed, 29 Aug 2018 14:05:48 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AC94080D; Wed, 29 Aug 2018 07:08:40 -0700 (PDT) Received: from [10.4.12.120] (e107158-lin.Emea.Arm.com [10.4.12.120]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E34983F721; Wed, 29 Aug 2018 07:08:39 -0700 (PDT) Subject: Re: [RFC PATCH 3/4] sched/topology: remove smt_gain To: Vincent Guittot , peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org References: <1535548752-4434-1-git-send-email-vincent.guittot@linaro.org> <1535548752-4434-4-git-send-email-vincent.guittot@linaro.org> From: Qais Yousef Message-ID: Date: Wed, 29 Aug 2018 15:08:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1535548752-4434-4-git-send-email-vincent.guittot@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/08/18 14:19, Vincent Guittot wrote: > smt_gain is used to compute the capacity of CPUs of a SMT core with the > constraint 1 < smt_gain < 2 in order to be able to compute number of CPUs > per core. The field has_free_capacity of struct numa_stat, which was the > last user of this computation of number of CPUs per core, has been removed > by : > > commit 2d4056fafa19 ("sched/numa: Remove numa_has_capacity()") > > We can now remove this constraint on core capacity and use the defautl value > SCHED_CAPACITY_SCALE for SMT CPUs. With this remove, SCHED_CAPACITY_SCALE > becomes the maximum compute capacity of CPUs on every systems. This should > help to simplify some code and remove fields like rd->max_cpu_capacity > > Furthermore, arch_scale_cpu_capacity() is used with a NULL sd in several other > places in the code when it wants the capacity of a CPUs to scale > some metrics like in pelt, deadline or schedutil. In case on SMT, the value > returned is not the capacity of SMT CPUs but default SCHED_CAPACITY_SCALE. > > Remove the smt_gain field from sched_domain struct You beat me to it, I got confused by smt_gain recently when I stumbled on it as I found out on ARM it's not used and had to spend sometime to convince myself it's not really necessary to use it. It was hard to track the history of this and *why* it's needed. The only 'theoretical' case I found smt_gain can be useful is when you have asymmetric system, for example: Node_A: 1 Core 2 Threads Node_B: 1 Core 4 Threads Then with smt_gain the group_capacity at the core level will be limited to smt_gain. But without smt_gain Node_B will look twice as powerful as Node_A - which will affect balancing AFAICT causing Node_B's single core to be oversubscribed as the 4 threads will still have to share the same underlying hardware resources. I don't think in practice such systems exists, or even make sense, though. So +1 from my side for the removal. > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: linux-kernel@vger.kernel.org (open list) > Signed-off-by: Vincent Guittot > --- > include/linux/sched/topology.h | 1 - > kernel/sched/sched.h | 3 --- > kernel/sched/topology.c | 2 -- > 3 files changed, 6 deletions(-) > > diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h > index 2634774..212792b 100644 > --- a/include/linux/sched/topology.h > +++ b/include/linux/sched/topology.h > @@ -89,7 +89,6 @@ struct sched_domain { > unsigned int newidle_idx; > unsigned int wake_idx; > unsigned int forkexec_idx; > - unsigned int smt_gain; > > int nohz_idle; /* NOHZ IDLE status */ > int flags; /* See SD_* */ > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > index 4a2e8ca..b1715b8 100644 > --- a/kernel/sched/sched.h > +++ b/kernel/sched/sched.h > @@ -1758,9 +1758,6 @@ unsigned long arch_scale_freq_capacity(int cpu) > static __always_inline > unsigned long arch_scale_cpu_capacity(struct sched_domain *sd, int cpu) > { > - if (sd && (sd->flags & SD_SHARE_CPUCAPACITY) && (sd->span_weight > 1)) > - return sd->smt_gain / sd->span_weight; > - > return SCHED_CAPACITY_SCALE; > } > #endif > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c > index 56a0fed..069c924 100644 > --- a/kernel/sched/topology.c > +++ b/kernel/sched/topology.c > @@ -1129,7 +1129,6 @@ sd_init(struct sched_domain_topology_level *tl, > > .last_balance = jiffies, > .balance_interval = sd_weight, > - .smt_gain = 0, > .max_newidle_lb_cost = 0, > .next_decay_max_lb_cost = jiffies, > .child = child, > @@ -1155,7 +1154,6 @@ sd_init(struct sched_domain_topology_level *tl, > if (sd->flags & SD_SHARE_CPUCAPACITY) { > sd->flags |= SD_PREFER_SIBLING; > sd->imbalance_pct = 110; > - sd->smt_gain = 1178; /* ~15% */ > > } else if (sd->flags & SD_SHARE_PKG_RESOURCES) { > sd->flags |= SD_PREFER_SIBLING; -- Qais Yousef