[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180628114043.24724-12-quentin.perret@arm.com>
Date: Thu, 28 Jun 2018 12:40:42 +0100
From: Quentin Perret <quentin.perret@....com>
To: peterz@...radead.org, rjw@...ysocki.net,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Cc: gregkh@...uxfoundation.org, mingo@...hat.com,
dietmar.eggemann@....com, morten.rasmussen@....com,
chris.redpath@....com, patrick.bellasi@....com,
valentin.schneider@....com, vincent.guittot@...aro.org,
thara.gopinath@...aro.org, viresh.kumar@...aro.org,
tkjos@...gle.com, joel@...lfernandes.org, smuckle@...gle.com,
adharmap@...cinc.com, skannan@...cinc.com, pkondeti@...eaurora.org,
juri.lelli@...hat.com, edubezval@...il.com,
srinivas.pandruvada@...ux.intel.com, currojerez@...eup.net,
javi.merino@...nel.org, quentin.perret@....com
Subject: [RFC PATCH v4 11/12] OPTIONAL: arch_topology: Start Energy Aware Scheduling
Energy Aware Scheduling (EAS) starts when the scheduling domains are
built if the Energy Model (EM) is present. However, in the typical case
of Arm/Arm64 systems, the EM is provided after the scheduling domains
are first built at boot time, which results in EAS staying disabled.
Fix this issue by re-building the scheduling domain from the arch
topology driver, once CPUfreq is up and running and when the CPU
capacities have been updated to their final value.
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Signed-off-by: Quentin Perret <quentin.perret@....com>
---
drivers/base/arch_topology.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index e7cb0c6ade81..2022174f5ac5 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -10,7 +10,9 @@
#include <linux/arch_topology.h>
#include <linux/cpu.h>
#include <linux/cpufreq.h>
+#include <linux/cpuset.h>
#include <linux/device.h>
+#include <linux/energy_model.h>
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/string.h>
@@ -173,6 +175,9 @@ static cpumask_var_t cpus_to_visit;
static void parsing_done_workfn(struct work_struct *work);
static DECLARE_WORK(parsing_done_work, parsing_done_workfn);
+static void start_eas_workfn(struct work_struct *work);
+static DECLARE_WORK(start_eas_work, start_eas_workfn);
+
static int
init_cpu_capacity_callback(struct notifier_block *nb,
unsigned long val,
@@ -204,6 +209,7 @@ init_cpu_capacity_callback(struct notifier_block *nb,
free_raw_capacity();
pr_debug("cpu_capacity: parsing done\n");
schedule_work(&parsing_done_work);
+ schedule_work(&start_eas_work);
}
return 0;
@@ -249,6 +255,15 @@ static void parsing_done_workfn(struct work_struct *work)
free_cpumask_var(cpus_to_visit);
}
+static void start_eas_workfn(struct work_struct *work)
+{
+ /* Make sure the EM knows about the updated CPU capacities. */
+ em_rescale_cpu_capacity();
+
+ /* Inform the scheduler about the EM availability. */
+ rebuild_sched_domains();
+}
+
#else
core_initcall(free_raw_capacity);
#endif
--
2.17.1
Powered by blists - more mailing lists