From 618218e3d737da03946dbd2d56fcc905973efadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20S=C5=82odczyk?= Date: Tue, 30 Jun 2020 16:14:54 +0200 Subject: cpu-sched: check app list on startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id0f468171e0b9b750bfc38e5e469928e270fa60f Signed-off-by: Maciej SĹ‚odczyk --- src/cpu/cpu-sched.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/cpu/cpu-sched.c b/src/cpu/cpu-sched.c index 992a051d..08b63f99 100644 --- a/src/cpu/cpu-sched.c +++ b/src/cpu/cpu-sched.c @@ -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: -- cgit v1.2.3