cpu-sched: check app list on startup 72/237472/5 accepted/tizen/unified/20200722.014938 submit/tizen/20200721.120800
authorMaciej Słodczyk <m.slodczyk2@partner.samsung.com>
Tue, 30 Jun 2020 14:14:54 +0000 (16:14 +0200)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 21 Jul 2020 11:56:50 +0000 (11:56 +0000)
Change-Id: Id0f468171e0b9b750bfc38e5e469928e270fa60f
Signed-off-by: Maciej Słodczyk <m.slodczyk2@partner.samsung.com>
src/cpu/cpu-sched.c

index 992a051..08b63f9 100644 (file)
@@ -536,6 +536,30 @@ static void cpu_sched_free_cpusets()
        cpu_sched_free_cpuset(&cs.fg);
 }
 
+static void cpu_sched_check_apps()
+{
+       _cleanup_app_list_close_ GSList *proc_app_list = PAL_INIT_VALUE;
+       GSList *giter;
+       struct proc_app_info *pai;
+       struct coreset *c;
+
+       proc_app_list = proc_app_list_open();
+       gslist_for_each_item(giter, proc_app_list) {
+               pai = (struct proc_app_info *)giter->data;
+               if (!pai || !pai->main_pid)
+                       continue;
+
+               c = cpu_sched_find_coreset(pai->appid);
+               if (NULL != c) {
+                       cpu_sched_add_pid_to_cpuset(c, pai->main_pid, false);
+                       continue;
+               }
+
+               if (pai->state == PROC_STATE_FOREGROUND)
+                       cpu_sched_add_pid_to_cpuset(&cs.fg, pai->main_pid, true);
+       }
+}
+
 static int cpu_sched_init(void *data)
 {
        int r;
@@ -557,6 +581,7 @@ static int cpu_sched_init(void *data)
        }
 
        cs.is_initalized = true;
+       cpu_sched_check_apps();
        return RESOURCED_ERROR_NONE;
 
 init_failed: