[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180521142505.6522-11-quentin.perret@arm.com>
Date: Mon, 21 May 2018 15:25:05 +0100
From: Quentin Perret <quentin.perret@....com>
To: peterz@...radead.org, rjw@...ysocki.net,
gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Cc: 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, joelaf@...gle.com,
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 v3 10/10] arch_topology: Start Energy Aware Scheduling
Energy Aware Scheduling starts when the scheduling domains are built if the
Energy Model is present and all conditions are met. However, in the typical
case of Arm/Arm64 systems, the Energy Model is provided after the scheduling
domains are first built at boot time, which results in EAS staying
disabled.
This commit fixes this issue by re-building the scheduling domain from the
arch topology driver, once CPUfreq is up and running and when the capacity
of the CPUs 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 | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index e7cb0c6ade81..7f9fa10ef940 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -15,6 +15,8 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/sched/topology.h>
+#include <linux/energy_model.h>
+#include <linux/cpuset.h>
DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;
@@ -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,19 @@ 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. */
+ rcu_read_lock();
+ em_rescale_cpu_capacity();
+ rcu_read_unlock();
+
+ /* Inform the scheduler about the EM availability. */
+ cpus_read_lock();
+ rebuild_sched_domains();
+ cpus_read_unlock();
+}
+
#else
core_initcall(free_raw_capacity);
#endif
--
2.17.0
Powered by blists - more mailing lists