Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp625172ybb; Wed, 8 Apr 2020 06:48:47 -0700 (PDT) X-Google-Smtp-Source: APiQypJxDwe103kknWDHuh1dK1WMWm3mluQFXEuS3LFqGQhcO+F+e9/rzvK4ehNkG5TNa8tCLuqc X-Received: by 2002:aca:bb83:: with SMTP id l125mr2463117oif.122.1586353727343; Wed, 08 Apr 2020 06:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586353727; cv=none; d=google.com; s=arc-20160816; b=r5v7HC/vStrG9NqNx+dYCpYKxBEDAoHn+z8GE+G/gaa1KKCB74IuPqZ7ZAyh7QN9jV uuzCwOOImnzZXTDsC9LIm6jD7+bMsQ8Lv8vMXa7SyN4XoB4tB04636cOmUCBaZtK37/G wiK62nfsnEM+VP/W8UXN6w6EZ4mjVe15wabVxNIuarBmI9XlsUnqIeLu3Jy7pqpcuB6z T2PuSiac8Aca+qIt1TVTBS7fXJ4Fgwhu/LsXK5xlB58fCyjbn2qVq3CB/JHVXCOshihH Ym2nD3Y9aYfJ3cOHdqrBRnLzsX6xS8jDncIpTM3pHUnoHwaMeh+B9h8+TG8q1jpctYdL wWRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=YO0DPEIowR6FKoT9Z2QqUeTnswzrFsJGk8ZK6iAlIKU=; b=oSbNFqYh19Ldhaf/6utuC63LHtvjLfb5nKnu474MEb7Z4TGjuQvSl1Q4dwI42QCnSA iegIHwFdwCXpFq5/8gXscsWjewpQQhCKNlFYUc1KkTJ7stZ81qf9N/dYCzbDdU+k+FpN U+NyPo3RR/ChgeGVZtZpkJttv+CiOKXAB7KG+LyyXswUu39RehvG5wF0SzeXXiVhRCxm ugAoJ0HotYV4gGY8Fxsxq9GGlLa4ViwvziqH746ifTZ2ssSVq6v54u6UDjYlsiRFUkzE Qo0ZUFJzuUwqISh7+N4atG/ZN/AXBPonNvGP9784alQyIB/TG8wezgenchiIPbZlh/GM 29RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YipZuW6X; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k21si1881246oik.231.2020.04.08.06.48.33; Wed, 08 Apr 2020 06:48:47 -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; dkim=pass header.i=@linaro.org header.s=google header.b=YipZuW6X; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728533AbgDHM3b (ORCPT + 99 others); Wed, 8 Apr 2020 08:29:31 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:37402 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728274AbgDHM3a (ORCPT ); Wed, 8 Apr 2020 08:29:30 -0400 Received: by mail-lf1-f66.google.com with SMTP id t11so5005324lfe.4 for ; Wed, 08 Apr 2020 05:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YO0DPEIowR6FKoT9Z2QqUeTnswzrFsJGk8ZK6iAlIKU=; b=YipZuW6X1zD7Wvyrp8vARlzLtnPe8PfbQVWbBfV421NTNrYJJOocOBDmHhANQZf4dL O/A2Io4sp3yWjH9+aGtyNht+VGYHZic2QbqmoRWkqavRoIdHjXmM/TSfx4uc/QrU7T+j f5EhaTLD+4z9IjVnVdfhGO0ECm4EwhvVtmcLaC0S/dZTXZ6nfEKKH+mi/ErqgAw+3VDq X2tFuEmyDr/0KETXmBYsgiMxrGwkHhjgpsPLhoIstUmk1mgW36iFX6hA3WHPvnBpgPoq J9qhwTi0aJJurvYXPq+SVoM1pKh3WliNSrNNHXV5x2zC3O3c95DXU0q1ze27E3TfLzHH pYkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YO0DPEIowR6FKoT9Z2QqUeTnswzrFsJGk8ZK6iAlIKU=; b=JyC3MhWOwJ80scOse/gFTHrYMrlHETS2BeUZKcozDTGS0p+ofhZKERdbnKTLYXUZd6 Ji0ZI8t/1axbwsD8UAJ68L0PB1HnVXOwHmWXLSCrQUP0YVRu8cnxZG1zZT9ZFQhazF2a kMhrB639JuWBVmlUGeaw0PLhYanBE8iz2pTW/LJPrxcGzqR8k7bBglw/k+WJYRrLu/1v AbIzsDIY3WkuZ8ZfAZDXDsWpwCtKagVl5oUa/oEgYww5HGZS5piF9moOpoZQRfjufU7K HtjK3qzL136FgYvTihq1usCkE0TTIk5BLooUahzhe9oypEmekVy4ZC6+c5R3iNdKDPYQ XQ3A== X-Gm-Message-State: AGi0PuaJk0wtgzn4bEOPA9SBSJEP5fpJy4cKIJzkToTiQZ+7w/OyiTuG Tna0Etf8J9DC1WhxtS1oortlXdPgtTSjqwq3HcThxA== X-Received: by 2002:ac2:46f9:: with SMTP id q25mr4507268lfo.149.1586348967692; Wed, 08 Apr 2020 05:29:27 -0700 (PDT) MIME-Version: 1.0 References: <20200408095012.3819-1-dietmar.eggemann@arm.com> <20200408095012.3819-2-dietmar.eggemann@arm.com> In-Reply-To: <20200408095012.3819-2-dietmar.eggemann@arm.com> From: Vincent Guittot Date: Wed, 8 Apr 2020 14:29:16 +0200 Message-ID: Subject: Re: [PATCH 1/4] sched/topology: Store root domain CPU capacity sum To: Dietmar Eggemann Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Steven Rostedt , Luca Abeni , Daniel Bristot de Oliveira , Wei Wang , Quentin Perret , Alessio Balsini , Pavan Kondeti , Patrick Bellasi , Morten Rasmussen , Valentin Schneider , Qais Yousef , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 8 Apr 2020 at 11:50, Dietmar Eggemann wrote: > > Add the sum of (original) CPU capacity of all member CPUs to the root > domain. > > This is needed for capacity-aware SCHED_DEADLINE admission control. > > Signed-off-by: Dietmar Eggemann > --- > kernel/sched/sched.h | 11 +++++++++++ > kernel/sched/topology.c | 14 ++++++++++---- > 2 files changed, 21 insertions(+), 4 deletions(-) > > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > index 1e72d1b3d3ce..91bd0cb0c529 100644 > --- a/kernel/sched/sched.h > +++ b/kernel/sched/sched.h > @@ -797,6 +797,7 @@ struct root_domain { > cpumask_var_t rto_mask; > struct cpupri cpupri; > > + unsigned long sum_cpu_capacity; > unsigned long max_cpu_capacity; > > /* > @@ -2393,6 +2394,16 @@ static inline unsigned long capacity_orig_of(int cpu) > { > return cpu_rq(cpu)->cpu_capacity_orig; > } > + > +static inline unsigned long rd_capacity(int cpu) > +{ > + return cpu_rq(cpu)->rd->sum_cpu_capacity; > +} > +#else > +static inline unsigned long rd_capacity(int cpu) > +{ > + return SCHED_CAPACITY_SCALE; > +} > #endif > > /** > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c > index 8344757bba6e..74b0c0fa4b1b 100644 > --- a/kernel/sched/topology.c > +++ b/kernel/sched/topology.c > @@ -2052,12 +2052,17 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att > /* Attach the domains */ > rcu_read_lock(); > for_each_cpu(i, cpu_map) { > + unsigned long cap = arch_scale_cpu_capacity(i); Why do you replace the use of rq->cpu_capacity_orig by arch_scale_cpu_capacity(i) ? There is nothing about this change in the commit message > + > rq = cpu_rq(i); > sd = *per_cpu_ptr(d.sd, i); > > /* Use READ_ONCE()/WRITE_ONCE() to avoid load/store tearing: */ > - if (rq->cpu_capacity_orig > READ_ONCE(d.rd->max_cpu_capacity)) > - WRITE_ONCE(d.rd->max_cpu_capacity, rq->cpu_capacity_orig); > + if (cap > READ_ONCE(d.rd->max_cpu_capacity)) > + WRITE_ONCE(d.rd->max_cpu_capacity, cap); > + > + WRITE_ONCE(d.rd->sum_cpu_capacity, > + READ_ONCE(d.rd->sum_cpu_capacity) + cap); > > cpu_attach_domain(sd, d.rd, i); > } > @@ -2067,8 +2072,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att > static_branch_inc_cpuslocked(&sched_asym_cpucapacity); > > if (rq && sched_debug_enabled) { > - pr_info("root domain span: %*pbl (max cpu_capacity = %lu)\n", > - cpumask_pr_args(cpu_map), rq->rd->max_cpu_capacity); > + pr_info("root domain span: %*pbl (capacity = %lu max cpu_capacity = %lu)\n", > + cpumask_pr_args(cpu_map), rq->rd->sum_cpu_capacity, > + rq->rd->max_cpu_capacity); > } > > ret = 0; > -- > 2.17.1 >