From: Unsung Lee Date: Mon, 4 Sep 2023 07:01:47 +0000 (+0900) Subject: resourced-cpu-boosting: Add is_cpu_busy argument into governor func X-Git-Tag: accepted/tizen/unified/20230906.014628^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8277e8a5a595d431a38b59548a8ab631c01e0508;p=platform%2Fcore%2Fsystem%2Fplugin%2Fresourced-generic.git resourced-cpu-boosting: Add is_cpu_busy argument into governor func Add is_cpu_busy argument into cpu_boosting_governor_govern_request function to return whehter system cpu is busy or not. resourced will use this information to decide whether to ignore stall event. Change-Id: I66c77f0c7589840fad63973b2319dc1620d07db6 Signed-off-by: Unsung Lee --- diff --git a/src/resourced-cpu-boosting/resourced-cpu-boosting.c b/src/resourced-cpu-boosting/resourced-cpu-boosting.c index 3f7c043..91de093 100644 --- a/src/resourced-cpu-boosting/resourced-cpu-boosting.c +++ b/src/resourced-cpu-boosting/resourced-cpu-boosting.c @@ -195,7 +195,7 @@ static bool is_cpu_contention_alleviated(guint timer_id, guint latest_timer_id) static int cpu_boosting_governor_govern_request ( GHashTable *cpu_boosting_info_table, cpu_boosting_level_e cpu_boosting_level, - GSList **cpu_boosting_controller_action) + GSList **cpu_boosting_controller_action, bool *is_cpu_busy) { GHashTableIter cpu_boosting_info_iter; resource_pid_t resource_pid; @@ -218,8 +218,24 @@ static int cpu_boosting_governor_govern_request ( goto error; } - if(!is_system_cpu_busy(BOOSTING_LEVEL_DECREASE_CPU_UTIL_THRESHOLD)) + if (is_cpu_busy == NULL) { + _E("is_cpu_busy argument cannot be NULL"); + ret = -EINVAL; + goto error; + } + + /** + * Check cpu utilization once per a stall event. + * If cpu is busy at CPU_BOOSTING_LEVEL_STRONG, + * then find out victims to decrease cpu boosting level. + */ + if (cpu_boosting_level == CPU_BOOSTING_LEVEL_STRONG + && !is_system_cpu_busy(BOOSTING_LEVEL_DECREASE_CPU_UTIL_THRESHOLD)) { + *is_cpu_busy = false; return 0; + } + + *is_cpu_busy = true; hash_size = g_hash_table_size(cpu_boosting_info_table); if (hash_size == 0)