From 56c6ca2f0845ec35d305ac05af7fc9a978d4fc73 Mon Sep 17 00:00:00 2001 From: Matej Kafka Date: Fri, 23 Jul 2021 04:29:18 +0200 Subject: [PATCH] per_process_pp: Only write frequency if process is running on the cluster at the moment --- src/power_policy/imx8_per_process.hpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/power_policy/imx8_per_process.hpp b/src/power_policy/imx8_per_process.hpp index d62819af..8a00e0a8 100644 --- a/src/power_policy/imx8_per_process.hpp +++ b/src/power_policy/imx8_per_process.hpp @@ -15,6 +15,8 @@ class PowerPolicy_Imx8_PerProcess : public PowerPolicy PowerManager pm{}; CpufreqPolicy &a53_pol; CpufreqPolicy &a72_pol; + const cpu_set a53_cpus{0b001111}; + const cpu_set a72_cpus{0b110000}; public: PowerPolicy_Imx8_PerProcess() @@ -31,12 +33,14 @@ class PowerPolicy_Imx8_PerProcess : public PowerPolicy void on_process_start(Process &proc) override { - // TODO: better bound checking - if (proc.a53_freq_i) { - a53_pol.write_frequency(a53_pol.available_frequencies->at(proc.a53_freq_i.value())); + // check if the process is requesting any specific frequency and + // if its current cpuset intersects with the A53/A72 cluster + cpu_set proc_cpus = proc.part.current_cpus; + if (proc.a53_freq_i && proc_cpus & a53_cpus) { + a53_pol.write_frequency_i(proc.a53_freq_i.value()); } - if (proc.a72_freq_i) { - a72_pol.write_frequency(a72_pol.available_frequencies->at(proc.a72_freq_i.value())); + if (proc.a72_freq_i && proc_cpus & a72_cpus) { + a72_pol.write_frequency_i(proc.a72_freq_i.value()); } } };