From 923fa6e3b3e902fbbcbf85737289dc95c3618b5f Mon Sep 17 00:00:00 2001 From: Unsung Lee Date: Thu, 13 Jul 2023 10:38:52 +0900 Subject: [PATCH] lowmem: Initalize task window info using app window info When LMK is triggered by low memory, task window information is needed to be initalize using app window information LMK governor needs to know window information to make an order of vicitim candidates. Currently, resourced app information includes itself window information. Therefore, app window information needs to be passed to task info. Change-Id: If54217a1a4738d3a01945e8c375d6c3d2144895e Signed-off-by: Unsung Lee --- src/resource-limiter/memory/lowmem.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/resource-limiter/memory/lowmem.c b/src/resource-limiter/memory/lowmem.c index e3c9c30..ef48f63 100644 --- a/src/resource-limiter/memory/lowmem.c +++ b/src/resource-limiter/memory/lowmem.c @@ -518,6 +518,25 @@ static bool is_foreground_app(int oom_score_adj, return true; } +static void init_task_window_info(struct task_info *task, struct proc_app_window_info window) +{ + assert(task); + + task->window_pid = window.pid; + task->x = window.x; + task->y = window.y; + task->z = window.z; + task->w = window.w; + task->h = window.h; + task->layer = window.layer; + task->opaque = window.opaque; + task->visibility = window.visibility; + task->is_transformed = window.is_transformed; + task->alpha = window.alpha; + task->is_focused = window.is_focused; + task->is_mapped = window.is_mapped; +} + static GArray *lowmem_get_task_info_app(int killer_flags, int start_oom, int end_oom) { GSList *iter = NULL; @@ -545,6 +564,8 @@ static GArray *lowmem_get_task_info_app(int killer_flags, int start_oom, int end continue; } + memset(&task, 0, sizeof(struct task_info)); + task.pid = pai->main_pid; if (pai->childs) { task.pids = g_array_new(false, false, sizeof(pid_t)); @@ -579,6 +600,7 @@ static GArray *lowmem_get_task_info_app(int killer_flags, int start_oom, int end task.oom_score_lru = pai->memory.oom_score_adj; } + init_task_window_info(&task, pai->window); g_array_append_val(lowmem_task_info_app_array, task); } @@ -634,6 +656,8 @@ static GArray *lowmem_get_task_info_proc() if (oom_score_adj > OOMADJ_SU && oom_score_adj <= OOMADJ_APP_MAX) continue; + memset(&task, 0, sizeof(struct task_info)); + /** * Currently, for tasks in the memory cgroup, * do not consider multiple tasks with one pgid. -- 2.7.4