summaryrefslogtreecommitdiffstats
path: root/include/linux/energy_model.h
diff options
context:
space:
mode:
authorLukasz Luba <lukasz.luba@arm.com>2024-02-08 11:55:43 +0000
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-02-08 15:00:28 +0100
commitaa11a7ebfd5d698f541641922beede1cb474bf70 (patch)
tree249db164cabc9532c3be6863cb8ab07b3c8345e3 /include/linux/energy_model.h
parentca0fc871f16f4bef746b5ba814b67afb59119700 (diff)
downloadlinux-aa11a7ebfd5d698f541641922beede1cb474bf70.tar.gz
linux-aa11a7ebfd5d698f541641922beede1cb474bf70.tar.bz2
linux-aa11a7ebfd5d698f541641922beede1cb474bf70.zip
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). Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/energy_model.h')
-rw-r--r--include/linux/energy_model.h12
1 files 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)