Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp374472imm; Mon, 21 May 2018 07:25:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqbD3++eo+dj47VdbPeikKOB69ZGrCeiOHoVVaCMN4vVaxM0HRRIPkXxZlWT4OQgHB9o17k X-Received: by 2002:a63:9b11:: with SMTP id r17-v6mr15537811pgd.297.1526912758986; Mon, 21 May 2018 07:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526912758; cv=none; d=google.com; s=arc-20160816; b=csdbXm3rhsz4UCTIKsAVQyttBMw8fim5G2TDK2tDSlpBZkpXePsYXUDMYt/K1DCszO 4fi6yWaujPtjz9NHS0syPptGRagpX1sO41s3+SrJm61akWAQIy2zQXQyVwGKX8swGodb tx3wSDTbUmWNKhyrc1jHt8HIgG3L5zMS15GxBDr6wtl7aX5D1//mmh0Bl2F1Fxfp6DiT a8UctPlGijkm39YSdtFXLhDcSEovPZEtiFKW7cKtbSa4viF8eVED00OjhDYN5Zepzx22 mHirvNNgu4M2RmbPkgDnQxKdY8xUlJxm4RDeMX5WgqeBhMKgoYfjUpTPCFSm7S+2vJri 5tWQ== 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=6LGKuj5kyqDs6yW8c3MguArbfqMf9pedmPDipzkxmfQ=; b=yIHy0Hmwv/MtHfRBFcSdHWvVthdugHZQjJBavQjkmdllz6eRvLEjuJJ1Nonzhf9s8W yBuRlsKD9fRGRoiFx+f3V4X8G0LDPDdfR4cXo/gnNhbIIUWrCk9D3rvF29ptnqJdNGve 5w6fv/BNuBVN7EovrM1QJ6Cr6c17+h8DQGLpVFTVltNG/BjJW/iZ2Xe+M0ZTmFft0pgs RbXXhEDk+dlMSznrV0DX9OF9X3fPqqOiTjG+0kdKCxYi1Src66azTw+5DtfJsmN3goqi xHMvxsPYa3xK9do4+u/luGREjVn7ImwNgEMMKTxYDGT0czLqNlnuw60n+LLWry2GbjIp rzJw== 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 g3-v6si11066657pgc.251.2018.05.21.07.25.44; Mon, 21 May 2018 07:25:58 -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 S1752830AbeEUOZd (ORCPT + 99 others); Mon, 21 May 2018 10:25:33 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50888 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752536AbeEUOZ1 (ORCPT ); Mon, 21 May 2018 10:25:27 -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 E62F11529; Mon, 21 May 2018 07:25:26 -0700 (PDT) Received: from e108498-lin.cambridge.arm.com (e108498-lin.cambridge.arm.com [10.1.210.84]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CF97C3F577; Mon, 21 May 2018 07:25:22 -0700 (PDT) From: Quentin Perret To: peterz@infradead.org, rjw@rjwysocki.net, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: 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, joelaf@google.com, smuckle@google.com, adharmap@quicinc.com, skannan@quicinc.com, 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: [RFC PATCH v3 01/10] sched: Relocate arch_scale_cpu_capacity Date: Mon, 21 May 2018 15:24:56 +0100 Message-Id: <20180521142505.6522-2-quentin.perret@arm.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521142505.6522-1-quentin.perret@arm.com> References: <20180521142505.6522-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 | 18 ------------------ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index 26347741ba50..1e24e88bee6d 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 15750c222ca2..ce562d3b7526 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1724,30 +1724,12 @@ unsigned long arch_scale_freq_capacity(int cpu) #ifdef CONFIG_SMP extern void sched_avg_update(struct rq *rq); -#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 - static inline void sched_rt_avg_update(struct rq *rq, u64 rt_delta) { rq->rt_avg += rt_delta * arch_scale_freq_capacity(cpu_of(rq)); sched_avg_update(rq); } #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 static inline void sched_rt_avg_update(struct rq *rq, u64 rt_delta) { } static inline void sched_avg_update(struct rq *rq) { } #endif -- 2.17.0