From 9595d4dc0d0d003ac965b32f8ce4d9ea17def608 Mon Sep 17 00:00:00 2001 From: Unsung Lee Date: Wed, 29 Nov 2023 20:52:11 +0900 Subject: [PATCH] memory-cgroup: Set oom score range between cgroup Set oom score range between cgroup. In this case, only perceptible and favorite apps can be moved between memory cgroups when the memory limit is set. Change-Id: I5cc350c3c18350c9f8c047c8fd6e0043bdfdc642 Signed-off-by: Unsung Lee --- src/common/cgroup/memory-cgroup.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common/cgroup/memory-cgroup.c b/src/common/cgroup/memory-cgroup.c index b104aa7..abb90b5 100644 --- a/src/common/cgroup/memory-cgroup.c +++ b/src/common/cgroup/memory-cgroup.c @@ -111,10 +111,15 @@ int memcg_get_lowest_oom_score_adj(enum cgroup_type cgroup_type, int *oom_score_ int cgroup_get_type(int oom_score_adj) { - if (oom_score_adj >= OOMADJ_BACKGRD_PERCEPTIBLE && - oom_score_adj < OOMADJ_BACKGRD_UNLOCKED + OOMADJ_APP_INCREASE) + /** + * Only perceptible app and favorite app will be moved between cgroup + * when app memory limit is set. + */ + if (oom_score_adj == OOMADJ_BACKGRD_PERCEPTIBLE) + return MEMCG_BACKGROUND_MRU; + else if(oom_score_adj >= OOMADJ_FAVORITE && oom_score_adj <= OOMADJ_FAVORITE_APP_MAX) return MEMCG_BACKGROUND_MRU; - else if (oom_score_adj >= OOMADJ_BACKGRD_UNLOCKED + OOMADJ_APP_INCREASE && + else if (oom_score_adj >= OOMADJ_BACKGRD_UNLOCKED && oom_score_adj <= OOMADJ_APP_MAX) return MEMCG_BACKGROUND_LRU; else -- 2.7.4