Skip to content

Commit aa11a7e

Browse files
lukaszluba-armrafaeljw
authored andcommitted
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 <[email protected]> Tested-by: Dietmar Eggemann <[email protected]> Signed-off-by: Lukasz Luba <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent ca0fc87 commit aa11a7e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

include/linux/energy_model.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,14 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
239239
unsigned long allowed_cpu_cap)
240240
{
241241
unsigned long freq, ref_freq, scale_cpu;
242+
struct em_perf_table *em_table;
242243
struct em_perf_state *ps;
243244
int cpu, i;
244245

246+
#ifdef CONFIG_SCHED_DEBUG
247+
WARN_ONCE(!rcu_read_lock_held(), "EM: rcu read lock needed\n");
248+
#endif
249+
245250
if (!sum_util)
246251
return 0;
247252

@@ -264,9 +269,10 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
264269
* Find the lowest performance state of the Energy Model above the
265270
* requested frequency.
266271
*/
267-
i = em_pd_get_efficient_state(pd->table, pd->nr_perf_states, freq,
268-
pd->flags);
269-
ps = &pd->table[i];
272+
em_table = rcu_dereference(pd->em_table);
273+
i = em_pd_get_efficient_state(em_table->state, pd->nr_perf_states,
274+
freq, pd->flags);
275+
ps = &em_table->state[i];
270276

271277
/*
272278
* The capacity of a CPU in the domain at the performance state (ps)

0 commit comments

Comments
 (0)