summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQais Yousef <qyousef@google.com>2023-07-25 16:38:34 +0000
committerQais Yousef <qyousef@google.com>2023-09-11 17:02:42 +0000
commit0fed377fceb66d9c3ce668e3771260bd66705b9e (patch)
tree7617b2fae5a5667c3ffc8d0548b3299b1de857a3
parentacbc9bacfebca3bdc11d2ef89738be0d6e4eb232 (diff)
downloadcommon-0fed377fceb66d9c3ce668e3771260bd66705b9e.tar.gz
ANDROID: cpuidle: teo: Export a function that allows modifying util_threshold
There are some corner cases where we do worse in power because the threshold is too low. Until these cases are better understood and addressed upstream, provide a function for vendors to override this value with something more suitable in their modules. Bug: 299931876 Bug: 297496375 Bug: 289293494 Signed-off-by: Qais Yousef <qyousef@google.com> Change-Id: I95dd36718a317f3fcb2a9f4bc87dd3390a4f7d7d (cherry picked from commit 619a5f635c8fe7639e5c0c33d1e70d752c71cd71) Signed-off-by: Qais Yousef <qyousef@google.com> (cherry picked from commit d2429181c3a761c6025c2d875854e0f44ab82cfa) Signed-off-by: Qais Yousef <qyousef@google.com>
-rw-r--r--drivers/cpuidle/governors/teo.c13
-rw-r--r--include/linux/cpuidle.h8
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
index e3fb01cb6564..9cc3081c545d 100644
--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -202,6 +202,19 @@ struct teo_cpu {
static DEFINE_PER_CPU(struct teo_cpu, teo_cpus);
+unsigned long teo_cpu_get_util_threshold(int cpu)
+{
+ struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, cpu);
+ return cpu_data->util_threshold;
+}
+EXPORT_SYMBOL_GPL(teo_cpu_get_util_threshold);
+void teo_cpu_set_util_threshold(int cpu, unsigned long util)
+{
+ struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, cpu);
+ cpu_data->util_threshold = util;
+}
+EXPORT_SYMBOL_GPL(teo_cpu_set_util_threshold);
+
/**
* teo_cpu_is_utilized - Check if the CPU's util is above the threshold
* @cpu: Target CPU
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 4b51019dd2b8..ac853b9372a2 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -314,4 +314,12 @@ extern s64 cpuidle_governor_latency_req(unsigned int cpu);
#define CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM(low_level_idle_enter, idx, state) \
__CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, state, 1)
+#ifdef CONFIG_CPU_IDLE_GOV_TEO
+unsigned long teo_cpu_get_util_threshold(int cpu);
+void teo_cpu_set_util_threshold(int cpu, unsigned long util);
+#else
+static inline unsigned long teo_cpu_get_util_threshold(int cpu) {return -1;}
+static inline void teo_cpu_set_util_threshold(int cpu, unsigned long util) {}
+#endif
+
#endif /* _LINUX_CPUIDLE_H */