* [PATCH v5 01/10] drivers base/arch_topology: free cpumask cpus_to_visit
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
@ 2017-09-26 16:41 ` Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 02/10] cpufreq: provide default frequency-invariance setter function Dietmar Eggemann
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Dietmar Eggemann @ 2017-09-26 16:41 UTC (permalink / raw)
To: linux-kernel
Cc: linux-pm, linux, Greg Kroah-Hartman, Russell King,
Catalin Marinas, Will Deacon, Juri Lelli, Vincent Guittot,
Peter Zijlstra, Morten Rasmussen, Viresh Kumar,
Rafael J . Wysocki, Sudeep Holla
Free cpumask cpus_to_visit in case registering
init_cpu_capacity_notifier has failed or the parsing of the cpu
capacity-dmips-mhz property is done. The cpumask cpus_to_visit is
only used inside the notifier call init_cpu_capacity_callback.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Reported-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Vincent Guittot <vincent.guittot@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Juri Lelli <juri.lelli@arm.com>
Reviewed-by: Juri Lelli <juri.lelli@arm.com>
---
drivers/base/arch_topology.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 41be9ff7d70a..e9bb368f32b3 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -212,6 +212,8 @@ static struct notifier_block init_cpu_capacity_notifier = {
static int __init register_cpufreq_notifier(void)
{
+ int ret;
+
/*
* on ACPI-based systems we need to use the default cpu capacity
* until we have the necessary code to parse the cpu capacity, so
@@ -227,8 +229,13 @@ static int __init register_cpufreq_notifier(void)
cpumask_copy(cpus_to_visit, cpu_possible_mask);
- return cpufreq_register_notifier(&init_cpu_capacity_notifier,
- CPUFREQ_POLICY_NOTIFIER);
+ ret = cpufreq_register_notifier(&init_cpu_capacity_notifier,
+ CPUFREQ_POLICY_NOTIFIER);
+
+ if (ret)
+ free_cpumask_var(cpus_to_visit);
+
+ return ret;
}
core_initcall(register_cpufreq_notifier);
@@ -236,6 +243,7 @@ static void parsing_done_workfn(struct work_struct *work)
{
cpufreq_unregister_notifier(&init_cpu_capacity_notifier,
CPUFREQ_POLICY_NOTIFIER);
+ free_cpumask_var(cpus_to_visit);
}
#else
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 02/10] cpufreq: provide default frequency-invariance setter function
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 01/10] drivers base/arch_topology: free cpumask cpus_to_visit Dietmar Eggemann
@ 2017-09-26 16:41 ` Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 03/10] cpufreq: arm_big_little: invoke " Dietmar Eggemann
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Dietmar Eggemann @ 2017-09-26 16:41 UTC (permalink / raw)
To: linux-kernel
Cc: linux-pm, linux, Greg Kroah-Hartman, Russell King,
Catalin Marinas, Will Deacon, Juri Lelli, Vincent Guittot,
Peter Zijlstra, Morten Rasmussen, Viresh Kumar,
Rafael J . Wysocki, Sudeep Holla
Frequency-invariant accounting support based on the ratio of current
frequency and maximum supported frequency is an optional feature an arch
can implement.
Since there are cpufreq drivers (e.g. cpufreq-dt) which can be build for
different arch's a default implementation of the frequency-invariance
setter function arch_set_freq_scale() is needed.
This default implementation is an empty weak function which will be
overwritten by a strong function in case the arch provides one.
The setter function passes the cpumask of related (to the frequency
change) cpus (online and offline cpus), the (new) current frequency and
the maximum supported frequency.
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq.c | 6 ++++++
include/linux/cpufreq.h | 3 +++
2 files changed, 9 insertions(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index ea43b147a7fe..41d148af7748 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -161,6 +161,12 @@ u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy)
}
EXPORT_SYMBOL_GPL(get_cpu_idle_time);
+__weak void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
+ unsigned long max_freq)
+{
+}
+EXPORT_SYMBOL_GPL(arch_set_freq_scale);
+
/*
* This is a generic cpufreq init() routine which can be used by cpufreq
* drivers of SMP systems. It will do following:
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 537ff842ff73..28734ee185a7 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -919,6 +919,9 @@ static inline bool policy_has_boost_freq(struct cpufreq_policy *policy)
extern unsigned int arch_freq_get_on_cpu(int cpu);
+extern void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
+ unsigned long max_freq);
+
/* the following are really really optional */
extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs;
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 03/10] cpufreq: arm_big_little: invoke frequency-invariance setter function
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 01/10] drivers base/arch_topology: free cpumask cpus_to_visit Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 02/10] cpufreq: provide default frequency-invariance setter function Dietmar Eggemann
@ 2017-09-26 16:41 ` Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 04/10] cpufreq: dt: " Dietmar Eggemann
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Dietmar Eggemann @ 2017-09-26 16:41 UTC (permalink / raw)
To: linux-kernel
Cc: linux-pm, linux, Greg Kroah-Hartman, Russell King,
Catalin Marinas, Will Deacon, Juri Lelli, Vincent Guittot,
Peter Zijlstra, Morten Rasmussen, Viresh Kumar,
Rafael J . Wysocki, Sudeep Holla
Call the frequency-invariance setter function arch_set_freq_scale()
if the new frequency has been successfully set which is indicated by
bL_cpufreq_set_rate() returning 0.
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/arm_big_little.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 17504129fd77..0c41ab3b16eb 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -213,6 +213,7 @@ static int bL_cpufreq_set_target(struct cpufreq_policy *policy,
{
u32 cpu = policy->cpu, cur_cluster, new_cluster, actual_cluster;
unsigned int freqs_new;
+ int ret;
cur_cluster = cpu_to_cluster(cpu);
new_cluster = actual_cluster = per_cpu(physical_cluster, cpu);
@@ -229,7 +230,14 @@ static int bL_cpufreq_set_target(struct cpufreq_policy *policy,
}
}
- return bL_cpufreq_set_rate(cpu, actual_cluster, new_cluster, freqs_new);
+ ret = bL_cpufreq_set_rate(cpu, actual_cluster, new_cluster, freqs_new);
+
+ if (!ret) {
+ arch_set_freq_scale(policy->related_cpus, freqs_new,
+ policy->cpuinfo.max_freq);
+ }
+
+ return ret;
}
static inline u32 get_table_count(struct cpufreq_frequency_table *table)
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 04/10] cpufreq: dt: invoke frequency-invariance setter function
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
` (2 preceding siblings ...)
2017-09-26 16:41 ` [PATCH v5 03/10] cpufreq: arm_big_little: invoke " Dietmar Eggemann
@ 2017-09-26 16:41 ` Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 05/10] drivers base/arch_topology: provide frequency-invariant accounting support Dietmar Eggemann
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Dietmar Eggemann @ 2017-09-26 16:41 UTC (permalink / raw)
To: linux-kernel
Cc: linux-pm, linux, Greg Kroah-Hartman, Russell King,
Catalin Marinas, Will Deacon, Juri Lelli, Vincent Guittot,
Peter Zijlstra, Morten Rasmussen, Viresh Kumar,
Rafael J . Wysocki, Sudeep Holla
Call the frequency-invariance setter function arch_set_freq_scale()
if the new frequency has been successfully set which is indicated by
dev_pm_opp_set_rate() returning 0.
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq-dt.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index d83ab94d041a..545946ad0752 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -43,9 +43,17 @@ static struct freq_attr *cpufreq_dt_attr[] = {
static int set_target(struct cpufreq_policy *policy, unsigned int index)
{
struct private_data *priv = policy->driver_data;
+ unsigned long freq = policy->freq_table[index].frequency;
+ int ret;
+
+ ret = dev_pm_opp_set_rate(priv->cpu_dev, freq * 1000);
- return dev_pm_opp_set_rate(priv->cpu_dev,
- policy->freq_table[index].frequency * 1000);
+ if (!ret) {
+ arch_set_freq_scale(policy->related_cpus, freq,
+ policy->cpuinfo.max_freq);
+ }
+
+ return ret;
}
/*
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 05/10] drivers base/arch_topology: provide frequency-invariant accounting support
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
` (3 preceding siblings ...)
2017-09-26 16:41 ` [PATCH v5 04/10] cpufreq: dt: " Dietmar Eggemann
@ 2017-09-26 16:41 ` Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 06/10] drivers base/arch_topology: allow inlining cpu-invariant " Dietmar Eggemann
` (5 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Dietmar Eggemann @ 2017-09-26 16:41 UTC (permalink / raw)
To: linux-kernel
Cc: linux-pm, linux, Greg Kroah-Hartman, Russell King,
Catalin Marinas, Will Deacon, Juri Lelli, Vincent Guittot,
Peter Zijlstra, Morten Rasmussen, Viresh Kumar,
Rafael J . Wysocki, Sudeep Holla
Implements the arch-specific (arm and arm64) frequency-invariance setter
function arch_set_freq_scale() which provides the following frequency
scaling factor:
current_freq(cpu) << SCHED_CAPACITY_SHIFT / max_supported_freq(cpu)
One possible consumer of the frequency-invariance getter function
topology_get_freq_scale() is the Per-Entity Load Tracking (PELT)
mechanism of the task scheduler.
Allow inlining of topology_get_freq_scale() into the task scheduler
fast path (e.g. __update_load_avg_se()) by coding it as a static inline
function in the arch topology header file.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/base/arch_topology.c | 14 ++++++++++++++
include/linux/arch_topology.h | 9 +++++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index e9bb368f32b3..416ec2f5211d 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -22,6 +22,20 @@
#include <linux/string.h>
#include <linux/sched/topology.h>
+DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;
+
+void arch_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 716ce587247e..f6e490312e4d 100644
--- a/include/linux/arch_topology.h
+++ b/include/linux/arch_topology.h
@@ -5,6 +5,7 @@
#define _LINUX_ARCH_TOPOLOGY_H_
#include <linux/types.h>
+#include <linux/percpu.h>
void topology_normalize_cpu_scale(void);
@@ -16,4 +17,12 @@ unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu);
void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity);
+DECLARE_PER_CPU(unsigned long, freq_scale);
+
+static inline
+unsigned long topology_get_freq_scale(struct sched_domain *sd, int cpu)
+{
+ return per_cpu(freq_scale, cpu);
+}
+
#endif /* _LINUX_ARCH_TOPOLOGY_H_ */
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 06/10] drivers base/arch_topology: allow inlining cpu-invariant accounting support
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
` (4 preceding siblings ...)
2017-09-26 16:41 ` [PATCH v5 05/10] drivers base/arch_topology: provide frequency-invariant accounting support Dietmar Eggemann
@ 2017-09-26 16:41 ` Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 07/10] arm: wire frequency-invariant accounting support up to the task scheduler Dietmar Eggemann
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Dietmar Eggemann @ 2017-09-26 16:41 UTC (permalink / raw)
To: linux-kernel
Cc: linux-pm, linux, Greg Kroah-Hartman, Russell King,
Catalin Marinas, Will Deacon, Juri Lelli, Vincent Guittot,
Peter Zijlstra, Morten Rasmussen, Viresh Kumar,
Rafael J . Wysocki, Sudeep Holla
Allow inlining of topology_get_cpu_scale() into the task
scheduler fast path (e.g. __update_load_avg_se()) by coding it as a
static inline function in the arch topology header file.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/base/arch_topology.c | 7 +------
include/linux/arch_topology.h | 8 +++++++-
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 416ec2f5211d..aea0b9d521f6 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -37,12 +37,7 @@ void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
}
static DEFINE_MUTEX(cpu_scale_mutex);
-static DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE;
-
-unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu)
-{
- return per_cpu(cpu_scale, cpu);
-}
+DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE;
void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity)
{
diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h
index f6e490312e4d..c189de3ef5df 100644
--- a/include/linux/arch_topology.h
+++ b/include/linux/arch_topology.h
@@ -12,8 +12,14 @@ void topology_normalize_cpu_scale(void);
struct device_node;
bool topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu);
+DECLARE_PER_CPU(unsigned long, cpu_scale);
+
struct sched_domain;
-unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu);
+static inline
+unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu)
+{
+ return per_cpu(cpu_scale, cpu);
+}
void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity);
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 07/10] arm: wire frequency-invariant accounting support up to the task scheduler
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
` (5 preceding siblings ...)
2017-09-26 16:41 ` [PATCH v5 06/10] drivers base/arch_topology: allow inlining cpu-invariant " Dietmar Eggemann
@ 2017-09-26 16:41 ` Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 08/10] arm: wire cpu-invariant " Dietmar Eggemann
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Dietmar Eggemann @ 2017-09-26 16:41 UTC (permalink / raw)
To: linux-kernel
Cc: linux-pm, linux, Greg Kroah-Hartman, Russell King,
Catalin Marinas, Will Deacon, Juri Lelli, Vincent Guittot,
Peter Zijlstra, Morten Rasmussen, Viresh Kumar,
Rafael J . Wysocki, Sudeep Holla
Commit dfbca41f3479 ("sched: Optimize freq invariant accounting")
changed the wiring which now has to be done by associating
arch_scale_freq_capacity with the actual implementation provided
by the architecture.
Define arch_scale_freq_capacity to use the arch_topology "driver"
function topology_get_freq_scale() for the task scheduler's
frequency-invariant accounting instead of the default
arch_scale_freq_capacity() in kernel/sched/sched.h.
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Vincent Guittot <vincent.guittot@linaro.org>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Tested-by: Juri Lelli <juri.lelli@arm.com>
Reviewed-by: Juri Lelli <juri.lelli@arm.com>
---
arch/arm/include/asm/topology.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h
index 370f7a732900..a56a9e24f4c0 100644
--- a/arch/arm/include/asm/topology.h
+++ b/arch/arm/include/asm/topology.h
@@ -24,6 +24,11 @@ void init_cpu_topology(void);
void store_cpu_topology(unsigned int cpuid);
const struct cpumask *cpu_coregroup_mask(int cpu);
+#include <linux/arch_topology.h>
+
+/* Replace task scheduler's default frequency-invariant accounting */
+#define arch_scale_freq_capacity topology_get_freq_scale
+
#else
static inline void init_cpu_topology(void) { }
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 08/10] arm: wire cpu-invariant accounting support up to the task scheduler
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
` (6 preceding siblings ...)
2017-09-26 16:41 ` [PATCH v5 07/10] arm: wire frequency-invariant accounting support up to the task scheduler Dietmar Eggemann
@ 2017-09-26 16:41 ` Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 09/10] arm64: wire frequency-invariant " Dietmar Eggemann
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Dietmar Eggemann @ 2017-09-26 16:41 UTC (permalink / raw)
To: linux-kernel
Cc: linux-pm, linux, Greg Kroah-Hartman, Russell King,
Catalin Marinas, Will Deacon, Juri Lelli, Vincent Guittot,
Peter Zijlstra, Morten Rasmussen, Viresh Kumar,
Rafael J . Wysocki, Sudeep Holla
Commit 8cd5601c5060 ("sched/fair: Convert arch_scale_cpu_capacity() from
weak function to #define") changed the wiring which now has to be done
by associating arch_scale_cpu_capacity with the actual implementation
provided by the architecture.
Define arch_scale_cpu_capacity to use the arch_topology "driver"
function topology_get_cpu_scale() for the task scheduler's cpu-invariant
accounting instead of the default arch_scale_cpu_capacity() in
kernel/sched/sched.h.
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Vincent Guittot <vincent.guittot@linaro.org>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Tested-by: Juri Lelli <juri.lelli@arm.com>
Reviewed-by: Juri Lelli <juri.lelli@arm.com>
---
arch/arm/include/asm/topology.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h
index a56a9e24f4c0..b713e7223bc4 100644
--- a/arch/arm/include/asm/topology.h
+++ b/arch/arm/include/asm/topology.h
@@ -29,6 +29,9 @@ const struct cpumask *cpu_coregroup_mask(int cpu);
/* Replace task scheduler's default frequency-invariant accounting */
#define arch_scale_freq_capacity topology_get_freq_scale
+/* Replace task scheduler's default cpu-invariant accounting */
+#define arch_scale_cpu_capacity topology_get_cpu_scale
+
#else
static inline void init_cpu_topology(void) { }
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 09/10] arm64: wire frequency-invariant accounting support up to the task scheduler
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
` (7 preceding siblings ...)
2017-09-26 16:41 ` [PATCH v5 08/10] arm: wire cpu-invariant " Dietmar Eggemann
@ 2017-09-26 16:41 ` Dietmar Eggemann
2017-09-26 16:41 ` [PATCH v5 10/10] arm64: wire cpu-invariant " Dietmar Eggemann
2017-10-04 8:41 ` [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for " Greg Kroah-Hartman
10 siblings, 0 replies; 13+ messages in thread
From: Dietmar Eggemann @ 2017-09-26 16:41 UTC (permalink / raw)
To: linux-kernel
Cc: linux-pm, linux, Greg Kroah-Hartman, Russell King,
Catalin Marinas, Will Deacon, Juri Lelli, Vincent Guittot,
Peter Zijlstra, Morten Rasmussen, Viresh Kumar,
Rafael J . Wysocki, Sudeep Holla
Commit dfbca41f3479 ("sched: Optimize freq invariant accounting")
changed the wiring which now has to be done by associating
arch_scale_freq_capacity with the actual implementation provided
by the architecture.
Define arch_scale_freq_capacity to use the arch_topology "driver"
function topology_get_freq_scale() for the task scheduler's
frequency-invariant accounting instead of the default
arch_scale_freq_capacity() in kernel/sched/sched.h.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Vincent Guittot <vincent.guittot@linaro.org>
Tested-by: Juri Lelli <juri.lelli@arm.com>
Reviewed-by: Juri Lelli <juri.lelli@arm.com>
---
arch/arm64/include/asm/topology.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h
index 8b57339823e9..44598a86ec4a 100644
--- a/arch/arm64/include/asm/topology.h
+++ b/arch/arm64/include/asm/topology.h
@@ -32,6 +32,11 @@ int pcibus_to_node(struct pci_bus *bus);
#endif /* CONFIG_NUMA */
+#include <linux/arch_topology.h>
+
+/* Replace task scheduler's default frequency-invariant accounting */
+#define arch_scale_freq_capacity topology_get_freq_scale
+
#include <asm-generic/topology.h>
#endif /* _ASM_ARM_TOPOLOGY_H */
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 10/10] arm64: wire cpu-invariant accounting support up to the task scheduler
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
` (8 preceding siblings ...)
2017-09-26 16:41 ` [PATCH v5 09/10] arm64: wire frequency-invariant " Dietmar Eggemann
@ 2017-09-26 16:41 ` Dietmar Eggemann
2017-10-04 8:41 ` [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for " Greg Kroah-Hartman
10 siblings, 0 replies; 13+ messages in thread
From: Dietmar Eggemann @ 2017-09-26 16:41 UTC (permalink / raw)
To: linux-kernel
Cc: linux-pm, linux, Greg Kroah-Hartman, Russell King,
Catalin Marinas, Will Deacon, Juri Lelli, Vincent Guittot,
Peter Zijlstra, Morten Rasmussen, Viresh Kumar,
Rafael J . Wysocki, Sudeep Holla
Commit 8cd5601c5060 ("sched/fair: Convert arch_scale_cpu_capacity() from
weak function to #define") changed the wiring which now has to be done
by associating arch_scale_cpu_capacity with the actual implementation
provided by the architecture.
Define arch_scale_cpu_capacity to use the arch_topology "driver"
function topology_get_cpu_scale() for the task scheduler's cpu-invariant
accounting instead of the default arch_scale_cpu_capacity() in
kernel/sched/sched.h.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Vincent Guittot <vincent.guittot@linaro.org>
Tested-by: Juri Lelli <juri.lelli@arm.com>
Reviewed-by: Juri Lelli <juri.lelli@arm.com>
---
arch/arm64/include/asm/topology.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h
index 44598a86ec4a..e313eeb10756 100644
--- a/arch/arm64/include/asm/topology.h
+++ b/arch/arm64/include/asm/topology.h
@@ -37,6 +37,9 @@ int pcibus_to_node(struct pci_bus *bus);
/* Replace task scheduler's default frequency-invariant accounting */
#define arch_scale_freq_capacity topology_get_freq_scale
+/* Replace task scheduler's default cpu-invariant accounting */
+#define arch_scale_cpu_capacity topology_get_cpu_scale
+
#include <asm-generic/topology.h>
#endif /* _ASM_ARM_TOPOLOGY_H */
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler
2017-09-26 16:41 [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
` (9 preceding siblings ...)
2017-09-26 16:41 ` [PATCH v5 10/10] arm64: wire cpu-invariant " Dietmar Eggemann
@ 2017-10-04 8:41 ` Greg Kroah-Hartman
2017-10-04 12:28 ` Rafael J. Wysocki
10 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2017-10-04 8:41 UTC (permalink / raw)
To: Dietmar Eggemann
Cc: linux-kernel, linux-pm, linux, Russell King, Catalin Marinas,
Will Deacon, Juri Lelli, Vincent Guittot, Peter Zijlstra,
Morten Rasmussen, Viresh Kumar, Rafael J . Wysocki, Sudeep Holla
On Tue, Sep 26, 2017 at 05:41:05PM +0100, Dietmar Eggemann wrote:
> For a more accurate (i.e. frequency- and cpu-invariant) accounting
> the task scheduler needs a frequency-scaling and on a heterogeneous
> system a cpu-scaling correction factor.
>
> This patch-set implements a Frequency Invariance Engine (FIE)
> based on the ratio of current frequency and maximum supported frequency
> (topology_get_freq_scale()) in the arch topology driver (arm, arm64) to
> provide such a frequency-scaling correction factor.
> This is a solution to get frequency-invariant accounting support for
> platforms without hardware-based performance tracking.
>
> The Cpu Invariance Engine (CIE) (topology_get_cpu_scale()) providing a
> cpu-scaling correction factor was already introduced by the "Fix issues
> and factorize arm/arm64 capacity information code" patch-set [1] which
> went into v4.13.
>
> This patch-set also enables the frequency- and cpu-invariant accounting
> support. Enabling here means to associate (wire) the task scheduler
> function name arch_scale_freq_capacity and arch_scale_cpu_capacity with
> the FIE and CIE function names from drivers/base/arch_topology.c. This
> replaces the scheduler's default FIE and CIE in kernel/sched/sched.h.
>
> v4: review results:
>
> There were no further comments during the v4 [2] review.
This patchset crosses a bunch of different subsystems, who do you
want/expect to be taking this through their tree?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for task scheduler
2017-10-04 8:41 ` [PATCH v5 00/10] arm, arm64, cpufreq: frequency- and cpu-invariant accounting support for " Greg Kroah-Hartman
@ 2017-10-04 12:28 ` Rafael J. Wysocki
0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2017-10-04 12:28 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Dietmar Eggemann, Linux Kernel Mailing List, Linux PM,
Russell King - ARM Linux, Russell King, Catalin Marinas,
Will Deacon, Juri Lelli, Vincent Guittot, Peter Zijlstra,
Morten Rasmussen, Viresh Kumar, Rafael J . Wysocki, Sudeep Holla
On Wed, Oct 4, 2017 at 10:41 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Tue, Sep 26, 2017 at 05:41:05PM +0100, Dietmar Eggemann wrote:
>> For a more accurate (i.e. frequency- and cpu-invariant) accounting
>> the task scheduler needs a frequency-scaling and on a heterogeneous
>> system a cpu-scaling correction factor.
>>
>> This patch-set implements a Frequency Invariance Engine (FIE)
>> based on the ratio of current frequency and maximum supported frequency
>> (topology_get_freq_scale()) in the arch topology driver (arm, arm64) to
>> provide such a frequency-scaling correction factor.
>> This is a solution to get frequency-invariant accounting support for
>> platforms without hardware-based performance tracking.
>>
>> The Cpu Invariance Engine (CIE) (topology_get_cpu_scale()) providing a
>> cpu-scaling correction factor was already introduced by the "Fix issues
>> and factorize arm/arm64 capacity information code" patch-set [1] which
>> went into v4.13.
>>
>> This patch-set also enables the frequency- and cpu-invariant accounting
>> support. Enabling here means to associate (wire) the task scheduler
>> function name arch_scale_freq_capacity and arch_scale_cpu_capacity with
>> the FIE and CIE function names from drivers/base/arch_topology.c. This
>> replaces the scheduler's default FIE and CIE in kernel/sched/sched.h.
>>
>> v4: review results:
>>
>> There were no further comments during the v4 [2] review.
>
> This patchset crosses a bunch of different subsystems, who do you
> want/expect to be taking this through their tree?
Dietmar asked me and I can handle it it that's not an issue.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 13+ messages in thread