Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5179922imm; Wed, 12 Sep 2018 02:13:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbPOMPKJS1gfzIASW6GqxZf59ZtQczHUTTA68tispz4NtrI3LB3IQ0W0a6dUMlt/10E96q/ X-Received: by 2002:a65:6110:: with SMTP id z16-v6mr1107655pgu.412.1536743631622; Wed, 12 Sep 2018 02:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536743631; cv=none; d=google.com; s=arc-20160816; b=zDMR1/GzyyYhCsNYKXcBoOTsGiSgUf9ElMBzK4snLJwZyq/Qf3obEAA5dobJfebXtd eHaVWQua/QaFkWQIlBBmLoou6IgympqqDSS7q8PGGaOX28i9LZfMsYo69TeLdbAUEwoV X5Smwhk6phO2Z0kA1XkiVnvcGC8jVL5PXE3SDLWWK4ltdPY/672sg0OCOGO3wHbWG3QM T4eP2doAKtZdcP8DiJ4g6Bbh636RCWm5T6AMAo0vHZccfZF8bVpPud1DuB3/OdpkFkRq 1OSOqNRe3JcE69iKcg/iv6fLfRMw05BzVxbFtrxfdkEN8zkjGiXJ3D+6yC9TvbMZeIpe HcFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=J61TWOVHetgbKiUwyj1qBpxX7B2XYhV3cIhp8eYZ+b0=; b=eaL4dQd76bV6gdWxl8Nf89TwS7icoVm15MaZ4+94QDC/upKbWsZ8UJInPJt72iFVtN t7f8I34K/sIrW6rbbU0k4ismNGwylKb+RUWjppekC1Tq5oG9GtiU4ha/4PfBmsb0VVuP 6ZS7mtQZXCfAoBNglpozRCFE0Tn8GB9ArQpbI8qkCR7wuCaBZnzyx582Ma16gv+1ge8B zyg+ofULTH+PYs+a6xNYfCuK6JOimhBiFrOu/m5zBRQSQoOuL0chR5rf9QeeZFFasMCj pYs74qB6a+UVd24eWTJe//b0rwCRRi2LHyUvUWrxswZsDZhpSqqYZhcAgjmpMkRsm6l0 Daog== 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 w14-v6si522198pgc.527.2018.09.12.02.13.36; Wed, 12 Sep 2018 02:13:51 -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 S1727957AbeILORD (ORCPT + 99 others); Wed, 12 Sep 2018 10:17:03 -0400 Received: from foss.arm.com ([217.140.101.70]:55760 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726901AbeILORC (ORCPT ); Wed, 12 Sep 2018 10:17:02 -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 A81621596; Wed, 12 Sep 2018 02:13:25 -0700 (PDT) Received: from queper01-lin.local (queper01-lin.emea.arm.com [10.4.13.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 900343F703; Wed, 12 Sep 2018 02:13:21 -0700 (PDT) From: Quentin Perret To: peterz@infradead.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: gregkh@linuxfoundation.org, mingo@redhat.com, dietmar.eggemann@arm.com, morten.rasmussen@arm.com, chris.redpath@arm.com, patrick.bellasi@arm.com, valentin.schneider@arm.com, vincent.guittot@linaro.org, thara.gopinath@linaro.org, viresh.kumar@linaro.org, tkjos@google.com, joel@joelfernandes.org, smuckle@google.com, adharmap@codeaurora.org, skannan@codeaurora.org, pkondeti@codeaurora.org, juri.lelli@redhat.com, edubezval@gmail.com, srinivas.pandruvada@linux.intel.com, currojerez@riseup.net, javi.merino@kernel.org, quentin.perret@arm.com Subject: [PATCH v7 01/14] sched: Relocate arch_scale_cpu_capacity Date: Wed, 12 Sep 2018 10:12:56 +0100 Message-Id: <20180912091309.7551-2-quentin.perret@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912091309.7551-1-quentin.perret@arm.com> References: <20180912091309.7551-1-quentin.perret@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org By default, arch_scale_cpu_capacity() is only visible from within the kernel/sched folder. Relocate it to include/linux/sched/topology.h to make it visible to other clients needing to know about the capacity of CPUs, such as the Energy Model framework. Cc: Ingo Molnar Cc: Peter Zijlstra Signed-off-by: Quentin Perret --- include/linux/sched/topology.h | 19 +++++++++++++++++++ kernel/sched/sched.h | 21 --------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index 4fe2e49ab13b..1aaa14462207 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -202,6 +202,17 @@ extern void set_sched_topology(struct sched_domain_topology_level *tl); # define SD_INIT_NAME(type) #endif +#ifndef arch_scale_cpu_capacity +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 + #else /* CONFIG_SMP */ struct sched_domain_attr; @@ -217,6 +228,14 @@ static inline bool cpus_share_cache(int this_cpu, int that_cpu) return true; } +#ifndef arch_scale_cpu_capacity +static __always_inline +unsigned long arch_scale_cpu_capacity(void __always_unused *sd, int cpu) +{ + return SCHED_CAPACITY_SCALE; +} +#endif + #endif /* !CONFIG_SMP */ static inline int task_node(const struct task_struct *p) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 85b3a2bf6c2b..481e6759441b 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1761,27 +1761,6 @@ unsigned long arch_scale_freq_capacity(int cpu) } #endif -#ifdef CONFIG_SMP -#ifndef arch_scale_cpu_capacity -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 -#else -#ifndef arch_scale_cpu_capacity -static __always_inline -unsigned long arch_scale_cpu_capacity(void __always_unused *sd, int cpu) -{ - return SCHED_CAPACITY_SCALE; -} -#endif -#endif - struct rq *__task_rq_lock(struct task_struct *p, struct rq_flags *rf) __acquires(rq->lock); -- 2.18.0