Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3671480imm; Mon, 20 Aug 2018 02:46:00 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzmN7PhYsyzM7KMw4fJsGOXH2bqOxSUHbcb2bDoD2QcJyNJZCxpVRuyn9uZv8ir8GITLzww X-Received: by 2002:a62:68c3:: with SMTP id d186-v6mr47559594pfc.70.1534758360609; Mon, 20 Aug 2018 02:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534758360; cv=none; d=google.com; s=arc-20160816; b=r4Js24aT7+SciozEMMi9MkjYlMP5VZVI8G1JbqU83ui+iJQBPDtU2Ttxz2HvQvdeKU KJEZUFk17WtJfHqlkWUGmN6MCqfNdga25uXICx/X3eeXKFREHy37Rd9zxDxXwcUvNKrP HYNas0W0Q2jDQJp98JKgrZle4bXKGFOHwqjjC7cCfdofXCZDLOoxmvBY0di8pzn9ngEV 2DWhqyQw4yD9zTpg73estr5B0jVzGiHOD0N0Qb7dn3I/kNqhjqzhu0LQ5SV2JMWF0GPf LUc4+jDs2m91nuL3+3bxTVuLtD4Sm2kcz/zocx1lLmT1RJFZJeWW2c2OeCBAoq9pk/VO klgw== 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:arc-authentication-results; bh=6m1LRbjatGe0quFYej9/lwUz1ayr3frDCRVszkgfjo8=; b=uszNFNQfT6lfQXq9jHbnmwvk4QpQPzFhrYZW+wJu+ojdaNxLlmW9bzlarQ9Ot797T5 eER34O9fhOjsjxCnkwhWFDsteSn7HorjviCte9Lu8n1Nz4TUi+ivkspk3HR4B8HqdNVy hn4IPa6Rh5QsSIDebAFA1EuTEdisEPh8B8cRDKEIA9QFwvUTy+s/JOm35wyMlVEM63EK Q0+ZTad4v3ZCMmC6L5HAE9DI4WqEmVetQvXEBlxcy/IzVnUjBm6w8617QjYabwQJX5Rm PusN5OryYd+DoEg673emOgB74RbQPcHgLOKZE8IzHcs2VQITvPkxcQnl1L60+BHARXPA 6wgQ== 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 y22-v6si9134489pgj.436.2018.08.20.02.45.45; Mon, 20 Aug 2018 02:46:00 -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 S1726560AbeHTM7c (ORCPT + 99 others); Mon, 20 Aug 2018 08:59:32 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:34816 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbeHTM7b (ORCPT ); Mon, 20 Aug 2018 08:59:31 -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 AB2F915B2; Mon, 20 Aug 2018 02:44:37 -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 93AF93F2EA; Mon, 20 Aug 2018 02:44:33 -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 v6 01/14] sched: Relocate arch_scale_cpu_capacity Date: Mon, 20 Aug 2018 10:44:07 +0100 Message-Id: <20180820094420.26590-2-quentin.perret@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180820094420.26590-1-quentin.perret@arm.com> References: <20180820094420.26590-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.17.1