resourced-cpu-boosting: Add is_cpu_busy argument into governor func 49/298249/8 accepted/tizen/unified/20230906.014628
authorUnsung Lee <unsung.lee@samsung.com>
Mon, 4 Sep 2023 07:01:47 +0000 (16:01 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Tue, 5 Sep 2023 00:33:21 +0000 (09:33 +0900)
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 <unsung.lee@samsung.com>
src/resourced-cpu-boosting/resourced-cpu-boosting.c

index 3f7c043ddc85962331ba8ea229efbde6512d5e67..91de0936be7f64f26a52802fac214ba3a6e5f798 100644 (file)
@@ -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)