[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240104171553.2080674-10-lukasz.luba@arm.com>
Date: Thu, 4 Jan 2024 17:15:39 +0000
From: Lukasz Luba <lukasz.luba@....com>
To: linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org,
rafael@...nel.org
Cc: lukasz.luba@....com,
dietmar.eggemann@....com,
rui.zhang@...el.com,
amit.kucheria@...durent.com,
amit.kachhap@...il.com,
daniel.lezcano@...aro.org,
viresh.kumar@...aro.org,
len.brown@...el.com,
pavel@....cz,
mhiramat@...nel.org,
qyousef@...alina.io,
wvw@...gle.com
Subject: [PATCH v6 09/23] PM: EM: Use runtime modified EM for CPUs energy estimation in EAS
The new Energy Model (EM) supports runtime modification of the performance
state table to better model the power used by the SoC. Use this new
feature to improve energy estimation and therefore task placement in
Energy Aware Scheduler (EAS).
Signed-off-by: Lukasz Luba <lukasz.luba@....com>
---
include/linux/energy_model.h | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
index 8ddf1d8a9581..5f842da3bb0c 100644
--- a/include/linux/energy_model.h
+++ b/include/linux/energy_model.h
@@ -239,9 +239,14 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
unsigned long allowed_cpu_cap)
{
unsigned long freq, ref_freq, scale_cpu;
+ struct em_perf_table *em_table;
struct em_perf_state *ps;
int cpu, i;
+#ifdef CONFIG_SCHED_DEBUG
+ WARN_ONCE(!rcu_read_lock_held(), "EM: rcu read lock needed\n");
+#endif
+
if (!sum_util)
return 0;
@@ -264,9 +269,10 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
* Find the lowest performance state of the Energy Model above the
* requested frequency.
*/
- i = em_pd_get_efficient_state(pd->table, pd->nr_perf_states, freq,
- pd->flags);
- ps = &pd->table[i];
+ em_table = rcu_dereference(pd->em_table);
+ i = em_pd_get_efficient_state(em_table->state, pd->nr_perf_states,
+ freq, pd->flags);
+ ps = &em_table->state[i];
/*
* The capacity of a CPU in the domain at the performance state (ps)
--
2.25.1
Powered by blists - more mailing lists