From e8954e5018b7c24b90a1e60f6dcf7cc08aa008af Mon Sep 17 00:00:00 2001 From: Unsung Lee Date: Fri, 1 Sep 2023 17:19:24 +0900 Subject: [PATCH] cpu-boosting: Check whether cpu stall handler is turned on Check cpu stall handler is turned on. If so, wake up cpu boosting thread to handle cpu stall. If not, ignore event from the cpu boosting monitor. Change-Id: Idc14a3804200291a6c4e9d021e590e98ba199e56 Signed-off-by: Unsung Lee --- src/common/conf/cpu-common.c | 11 +++++++++++ src/common/conf/cpu-common.h | 4 ++++ src/resource-optimizer/cpu/cpu-boosting.c | 7 +++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/common/conf/cpu-common.c b/src/common/conf/cpu-common.c index f264360..56694e2 100644 --- a/src/common/conf/cpu-common.c +++ b/src/common/conf/cpu-common.c @@ -25,6 +25,17 @@ static struct cpu_sched_conf *cpu_sched_conf = NULL; static struct cpu_affinity_conf *cpu_affinity_conf = NULL; static struct cpu_throttling_conf *cpu_throttling_conf = NULL; static struct cpu_boosting_conf *cpu_boosting_conf[CPU_BOOSTING_LEVEL_END] = {NULL, }; +static bool cpu_boosting_cpu_stall_handler_enabled = false; + +void cpu_boosting_enable_cpu_stall_handler(void) +{ + cpu_boosting_cpu_stall_handler_enabled = true; +} + +bool cpu_boosting_is_enabled_of_cpu_stall_handler(void) +{ + return cpu_boosting_cpu_stall_handler_enabled; +} struct cpu_sched_conf *get_cpu_sched_conf(void) { diff --git a/src/common/conf/cpu-common.h b/src/common/conf/cpu-common.h index 4e4e0f1..5e3013f 100644 --- a/src/common/conf/cpu-common.h +++ b/src/common/conf/cpu-common.h @@ -91,6 +91,10 @@ struct cpu_boosting_conf { struct cpu_sched_info cpu_sched_info; }; +void cpu_boosting_enable_cpu_stall_handler(void); +bool cpu_boosting_is_enabled_of_cpu_stall_handler(void); + + struct cpu_sched_conf *get_cpu_sched_conf(void); void free_cpu_sched_conf(void); diff --git a/src/resource-optimizer/cpu/cpu-boosting.c b/src/resource-optimizer/cpu/cpu-boosting.c index 4ce18b5..7622540 100644 --- a/src/resource-optimizer/cpu/cpu-boosting.c +++ b/src/resource-optimizer/cpu/cpu-boosting.c @@ -382,8 +382,11 @@ void cpu_boosting_wakeup_cpu_boosting_thread(void) * so, the monitor should wakeup the cpu boosting main thread * to call governor. */ - g_main_context_invoke(cpu_boosting_context, - cpu_boosting_governor_govern_request, NULL); + if (cpu_boosting_is_enabled_of_cpu_stall_handler()) + g_main_context_invoke(cpu_boosting_context, + cpu_boosting_governor_govern_request, NULL); + else + _I("[CPU-BOOSTING] CPU stall handler is turned off"); } static cpu_boosting_level_e cpu_boosting_level_search(struct sched_attr attr) -- 2.7.4