From patchwork Mon Aug 17 15:59:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 7025661 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6B0929F373 for ; Mon, 17 Aug 2015 15:59:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 71762204EB for ; Mon, 17 Aug 2015 15:59:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 268B320525 for ; Mon, 17 Aug 2015 15:59:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752555AbbHQP7g (ORCPT ); Mon, 17 Aug 2015 11:59:36 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([207.82.80.143]:33024 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbbHQP7f convert rfc822-to-8bit (ORCPT ); Mon, 17 Aug 2015 11:59:35 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-22-uwt2UehCR66AedBCWuM6Iw-1; Mon, 17 Aug 2015 16:59:32 +0100 Received: from [10.2.131.51] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 17 Aug 2015 16:59:31 +0100 Message-ID: <55D204E1.3000008@arm.com> Date: Mon, 17 Aug 2015 16:59:29 +0100 From: Dietmar Eggemann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Vincent Guittot , Morten Rasmussen CC: Peter Zijlstra , "mingo@redhat.com" , Daniel Lezcano , Yuyang Du , Michael Turquette , "rjw@rjwysocki.net" , Juri Lelli , "sgurrappadi@nvidia.com" , "pang.xunlei@zte.com.cn" , linux-kernel , "linux-pm@vger.kernel.org" , Russell King Subject: Re: [RFCv5 PATCH 01/46] arm: Frequency invariant scheduler load-tracking support References: <1436293469-25707-1-git-send-email-morten.rasmussen@arm.com> <1436293469-25707-2-git-send-email-morten.rasmussen@arm.com> In-Reply-To: X-OriginalArrivalTime: 17 Aug 2015 15:59:31.0516 (UTC) FILETIME=[B434AFC0:01D0D905] X-MC-Unique: uwt2UehCR66AedBCWuM6Iw-1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Vincent, On 03/08/15 10:22, Vincent Guittot wrote: > Hi Morten, > > > On 7 July 2015 at 20:23, Morten Rasmussen wrote: >> From: Morten Rasmussen >> > > [snip] > >> - >> #endif >> diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c >> index 08b7847..9c09e6e 100644 >> --- a/arch/arm/kernel/topology.c >> +++ b/arch/arm/kernel/topology.c >> @@ -169,6 +169,23 @@ static void update_cpu_capacity(unsigned int cpu) >> cpu, arch_scale_cpu_capacity(NULL, cpu)); >> } >> >> +/* >> + * Scheduler load-tracking scale-invariance >> + * >> + * Provides the scheduler with a scale-invariance correction factor that >> + * compensates for frequency scaling (arch_scale_freq_capacity()). The scaling >> + * factor is updated in smp.c >> + */ >> +unsigned long arm_arch_scale_freq_capacity(struct sched_domain *sd, int cpu) >> +{ >> + unsigned long curr = atomic_long_read(&per_cpu(cpu_freq_capacity, cpu)); > > access to cpu_freq_capacity to should be put under #ifdef CONFIG_CPU_FREQ. True, in case we keep everything related to frequency scaling under CONFIG_CPU_FREQ, then we should also put the #define arch_scale_freq_capacity arm_arch_scale_freq_capacity in topology.h under CONFIG_CPU_FREQ. > Why haven't you moved arm_arch_scale_freq_capacity in smp.c as > everything else for frequency in-variance is already in this file ? > This should also enable you to remove > DECLARE_PER_CPU(atomic_long_t, cpu_freq_capacity); from topology.h True, arm_arch_scale_freq_capacity() should be in smp.c so we don't have to export cpu_freq_capacity which btw. does not have to be a atomic. OTHA, we could also put the whole 'Frequency Invariance Engine' into cpufreq.c as cpufreq_scale_freq_capacity() and let the interested ARCH do a #include #define arch_scale_freq_capacity cpufreq_scale_freq_capacity This would allow us to implement this 'Frequency Invariance Engine' only once and not couple of times for different ARCHs. Something like this: (only compile tested on ARM64 w/ and w/o CONFIG_CPU_FREQ) [...] --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h index a8a69a1f3c4c..f25341170749 100644 --- a/arch/arm64/include/asm/topology.h +++ b/arch/arm64/include/asm/topology.h @@ -4,6 +4,7 @@ #ifdef CONFIG_SMP #include +#include struct cpu_topology { int thread_id; @@ -26,9 +27,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu); struct sched_domain; #ifdef CONFIG_CPU_FREQ -#define arch_scale_freq_capacity arm_arch_scale_freq_capacity -extern -unsigned long arm_arch_scale_freq_capacity(struct sched_domain *sd, int cpu); +#define arch_scale_freq_capacity cpufreq_scale_freq_capacity #endif #define arch_scale_cpu_capacity arm_arch_scale_cpu_capacity diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index b612411655f9..97f4391d0f55 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2400,6 +2400,12 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb, return NOTIFY_OK; } +unsigned long cpufreq_scale_freq_capacity(struct sched_domain *sd, int cpu) +{ + return 1024; /* Implementation missing !!! */ +} +EXPORT_SYMBOL(cpufreq_scale_freq_capacity); + static struct notifier_block __refdata cpufreq_cpu_notifier = { .notifier_call = cpufreq_cpu_callback, }; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 29ad97c34fd5..a4516d53a3cc 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -604,4 +604,11 @@ unsigned int cpufreq_generic_get(unsigned int cpu); int cpufreq_generic_init(struct cpufreq_policy *policy, struct cpufreq_frequency_table *table, unsigned int transition_latency); +/* + * In case we delete unused sd pointer in arch_scale_freq_capacity() + * [kernel/sched/sched.h] this can become: + * unsigned long cpufreq_scale_freq_capacity(int cpu); + */ +struct sched_domain; +unsigned long cpufreq_scale_freq_capacity(struct sched_domain *sd, int cpu);