From: Unsung Lee Date: Thu, 30 Nov 2023 08:19:12 +0000 (+0900) Subject: cpu-sched: Exclude apps that are not foreground but have PROC_STATE_FOREGROUND state X-Git-Tag: accepted/tizen/unified/20240104.012423^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0f1f78456ba6162ce0165f5d3d4a90416fc945b5;p=platform%2Fcore%2Fsystem%2Fresourced.git cpu-sched: Exclude apps that are not foreground but have PROC_STATE_FOREGROUND state 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 --- diff --git a/src/resource-optimizer/cpu/cpu-sched.c b/src/resource-optimizer/cpu/cpu-sched.c index a5e5208..968fd89 100644 --- a/src/resource-optimizer/cpu/cpu-sched.c +++ b/src/resource-optimizer/cpu/cpu-sched.c @@ -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); } }