linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	linux@arm.linux.org.uk,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Russell King <rmk+kernel@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Juri Lelli <juri.lelli@arm.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH v2 03/10] drivers base/arch_topology: frequency-invariant load-tracking support
Date: Thu, 6 Jul 2017 16:15:15 +0530	[thread overview]
Message-ID: <20170706104515.GD13048@vireshk-i7> (raw)
In-Reply-To: <20170706094948.8779-4-dietmar.eggemann@arm.com>

On 06-07-17, 10:49, Dietmar Eggemann wrote:
> Implements an arch-specific frequency-scaling function
> topology_get_freq_scale() which provides the following frequency
> scaling factor:
> 
>   current_freq(cpu) << SCHED_CAPACITY_SHIFT / max_supported_freq(cpu)
> 
> One possible consumer of this is the Per-Entity Load Tracking (PELT)
> mechanism of the task scheduler.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Juri Lelli <juri.lelli@arm.com>
> Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
> ---
>  drivers/base/arch_topology.c  | 20 ++++++++++++++++++++
>  include/linux/arch_topology.h |  7 +++++++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
> index f4832c662762..63fb3f945d21 100644
> --- a/drivers/base/arch_topology.c
> +++ b/drivers/base/arch_topology.c
> @@ -22,6 +22,26 @@
>  #include <linux/string.h>
>  #include <linux/sched/topology.h>
>  
> +static DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;
> +
> +unsigned long topology_get_freq_scale(struct sched_domain *sd, int cpu)
> +{
> +	return per_cpu(freq_scale, cpu);
> +}
> +
> +void topology_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
> +			     unsigned long max_freq)
> +{
> +	unsigned long scale;
> +	int i;
> +
> +	scale = (cur_freq << SCHED_CAPACITY_SHIFT) / max_freq;
> +
> +	for_each_cpu(i, cpus)
> +		per_cpu(freq_scale, i) = scale;
> +}
> +
> +
>  static DEFINE_MUTEX(cpu_scale_mutex);
>  static DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE;
>  
> diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h
> index 9af3c174c03a..168104d2d2cf 100644
> --- a/include/linux/arch_topology.h
> +++ b/include/linux/arch_topology.h
> @@ -4,6 +4,8 @@
>  #ifndef _LINUX_ARCH_TOPOLOGY_H_
>  #define _LINUX_ARCH_TOPOLOGY_H_
>  
> +#include <linux/cpumask.h>
> +

You don't need a full include here, instead following will work pretty well.

struct cpumask;

>  void topology_normalize_cpu_scale(void);
>  
>  struct device_node;
> @@ -14,4 +16,9 @@ unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu);
>  
>  void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity);
>  
> +unsigned long topology_get_freq_scale(struct sched_domain *sd, int cpu);
> +
> +void topology_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
> +			     unsigned long max_freq);
> +
>  #endif /* _LINUX_ARCH_TOPOLOGY_H_ */

Apart from that:

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

  reply	other threads:[~2017-07-06 10:45 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06  9:49 [PATCH v2 00/10] arm, arm64: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
2017-07-06  9:49 ` [PATCH v2 01/10] drivers base/arch_topology: free cpumask cpus_to_visit Dietmar Eggemann
2017-07-06 10:22   ` Viresh Kumar
2017-07-06 10:59     ` Juri Lelli
2017-07-06 11:15       ` Viresh Kumar
2017-07-07 15:50         ` Dietmar Eggemann
2017-07-06  9:49 ` [PATCH v2 02/10] cpufreq: provide data for frequency-invariant load-tracking support Dietmar Eggemann
2017-07-06 10:40   ` Viresh Kumar
2017-07-06 22:38     ` Rafael J. Wysocki
2017-07-07 16:01     ` Dietmar Eggemann
2017-07-07 16:18       ` Rafael J. Wysocki
2017-07-07 17:06         ` Dietmar Eggemann
2017-07-08 12:09           ` Rafael J. Wysocki
2017-07-10  6:54             ` Viresh Kumar
2017-07-10 12:46               ` Rafael J. Wysocki
2017-07-11  6:39                 ` Viresh Kumar
2017-07-11 15:21                   ` Dietmar Eggemann
2017-07-13 12:40                     ` Sudeep Holla
2017-07-13 13:08                       ` Dietmar Eggemann
2017-07-13 14:06                         ` Sudeep Holla
2017-07-10  9:30             ` Peter Zijlstra
2017-07-10  9:42               ` Viresh Kumar
2017-07-10 10:31                 ` Dietmar Eggemann
2017-07-10 12:02             ` Dietmar Eggemann
2017-07-11  6:01               ` Viresh Kumar
2017-07-11 15:06                 ` Dietmar Eggemann
2017-07-11 14:59                   ` Rafael J. Wysocki
2017-07-11 15:12                     ` Dietmar Eggemann
2017-07-12  4:09                   ` Viresh Kumar
2017-07-12  8:31                     ` Peter Zijlstra
2017-07-12  9:27                       ` Viresh Kumar
2017-07-12 11:14                         ` Peter Zijlstra
2017-07-12 23:13                           ` Rafael J. Wysocki
2017-07-13  7:49                             ` Peter Zijlstra
2017-07-13  8:48                             ` Viresh Kumar
2017-07-13 11:15                               ` Peter Zijlstra
2017-07-13 14:04                           ` Sudeep Holla
2017-07-13 14:42                             ` Peter Zijlstra
2017-07-13 15:00                               ` Sudeep Holla
2017-07-13 12:54                         ` Sudeep Holla
2017-07-13 12:49                     ` Sudeep Holla
2017-07-10  6:40       ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 03/10] drivers base/arch_topology: " Dietmar Eggemann
2017-07-06 10:45   ` Viresh Kumar [this message]
2017-07-07 16:51     ` Dietmar Eggemann
2017-07-06  9:49 ` [PATCH v2 04/10] arm: wire cpufreq input data for frequency-invariant accounting up to the arch Dietmar Eggemann
2017-07-06 10:42   ` Viresh Kumar
2017-07-10 15:13     ` Dietmar Eggemann
2017-07-11  6:32       ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 05/10] arm: wire frequency-invariant accounting support up to the task scheduler Dietmar Eggemann
2017-07-06 10:46   ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 06/10] arm: wire cpu-invariant " Dietmar Eggemann
2017-07-06 10:47   ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 07/10] arm64: wire cpufreq input data for frequency-invariant accounting up to the arch Dietmar Eggemann
2017-07-06 10:48   ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 08/10] arm64: wire frequency-invariant accounting support up to the task scheduler Dietmar Eggemann
2017-07-06 10:48   ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 09/10] arm64: wire cpu-invariant " Dietmar Eggemann
2017-07-06 10:49   ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 10/10] drivers base/arch_topology: inline cpu- and frequency-invariant accounting Dietmar Eggemann
2017-07-06 10:57   ` Viresh Kumar
2017-07-10 15:17     ` Dietmar Eggemann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170706104515.GD13048@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=juri.lelli@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=vincent.guittot@linaro.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).