From patchwork Wed Jun 22 17:03:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Rasmussen X-Patchwork-Id: 70670 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp15001qgy; Wed, 22 Jun 2016 10:03:33 -0700 (PDT) X-Received: by 10.36.91.66 with SMTP id g63mr15576643itb.16.1466615009093; Wed, 22 Jun 2016 10:03:29 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vy4si841055pab.231.2016.06.22.10.03.28; Wed, 22 Jun 2016 10:03:29 -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 S1753196AbcFVRCo (ORCPT + 30 others); Wed, 22 Jun 2016 13:02:44 -0400 Received: from foss.arm.com ([217.140.101.70]:49316 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752528AbcFVRCj (ORCPT ); Wed, 22 Jun 2016 13:02:39 -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 69274BB1; Wed, 22 Jun 2016 10:03:26 -0700 (PDT) Received: from e105550-lin.cambridge.arm.com (e105550-lin.cambridge.arm.com [10.1.207.130]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DFB2C3F246; Wed, 22 Jun 2016 10:02:37 -0700 (PDT) From: Morten Rasmussen To: peterz@infradead.org, mingo@redhat.com Cc: dietmar.eggemann@arm.com, yuyang.du@intel.com, vincent.guittot@linaro.org, mgalbraith@suse.de, linux-kernel@vger.kernel.org, Morten Rasmussen Subject: [PATCH v2 06/13] sched: Store maximum per-cpu capacity in root domain Date: Wed, 22 Jun 2016 18:03:17 +0100 Message-Id: <1466615004-3503-7-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466615004-3503-1-git-send-email-morten.rasmussen@arm.com> References: <1466615004-3503-1-git-send-email-morten.rasmussen@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dietmar Eggemann To be able to compare the capacity of the target cpu with the highest available cpu capacity, store the maximum per-cpu capacity in the root domain. cc: Ingo Molnar cc: Peter Zijlstra Signed-off-by: Dietmar Eggemann Signed-off-by: Morten Rasmussen --- kernel/sched/core.c | 9 +++++++++ kernel/sched/sched.h | 2 ++ 2 files changed, 11 insertions(+) -- 1.9.1 diff --git a/kernel/sched/core.c b/kernel/sched/core.c index fe39118ffdfb..5093765e9930 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6855,6 +6855,7 @@ static int build_sched_domains(const struct cpumask *cpu_map, enum s_alloc alloc_state; struct sched_domain *sd; struct s_data d; + struct rq *rq = NULL; int i, ret = -ENOMEM; alloc_state = __visit_domain_allocation_hell(&d, cpu_map); @@ -6905,11 +6906,19 @@ static int build_sched_domains(const struct cpumask *cpu_map, /* Attach the domains */ rcu_read_lock(); for_each_cpu(i, cpu_map) { + rq = cpu_rq(i); sd = *per_cpu_ptr(d.sd, i); cpu_attach_domain(sd, d.rd, i); + + if (rq->cpu_capacity_orig > rq->rd->max_cpu_capacity) + rq->rd->max_cpu_capacity = rq->cpu_capacity_orig; } rcu_read_unlock(); + if (rq) + pr_info("span: %*pbl (max cpu_capacity = %lu)\n", + cpumask_pr_args(cpu_map), rq->rd->max_cpu_capacity); + ret = 0; error: __free_domain_allocs(&d, alloc_state, cpu_map); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 72f1f3087b04..3e9904ef224f 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -564,6 +564,8 @@ struct root_domain { */ cpumask_var_t rto_mask; struct cpupri cpupri; + + unsigned long max_cpu_capacity; }; extern struct root_domain def_root_domain;