cpu-sched: Exclude apps that are not foreground but have PROC_STATE_FOREGROUND state 09/303609/1 accepted/tizen_unified_riscv accepted/tizen/unified/20240104.012423 accepted/tizen/unified/20240105.013014 accepted/tizen/unified/riscv/20240103.054535
authorUnsung Lee <unsung.lee@samsung.com>
Thu, 30 Nov 2023 08:19:12 +0000 (17:19 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Tue, 2 Jan 2024 08:46:56 +0000 (17:46 +0900)
Exclude apps that are not foreground but have PROC_STATE_FOREGROUND state from
foreground cpu affinity group. cpu-sched module initially searches already
launched foreground app and move them to foreground cpu affinity grouop.

Change-Id: I3692d6a4e70c08babc5547326133099ac20ebf91
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/resource-optimizer/cpu/cpu-sched.c

index a5e5208..968fd89 100644 (file)
@@ -12,6 +12,7 @@
 #include "cpu-cgroup.h"
 #include "cpu-common.h"
 #include "util.h"
+#include "procfs.h"
 
 #define MOUNTS_PATH                    "/proc/mounts"
 #define CPUSET_CGROUP          "/sys/fs/cgroup/cpuset"
@@ -658,7 +659,8 @@ static void cpu_sched_check_apps()
                        continue;
                }
 
-               if (cs.fg && pai->state == PROC_STATE_FOREGROUND)
+               if (cs.fg && pai->state == PROC_STATE_FOREGROUND &&
+                               pai->memory.oom_score_adj < OOMADJ_BACKGRD_LOCKED)
                        cpu_sched_add_pid_to_cpuset(cs.fg, pai->main_pid);
        }
 }