proc-main: Init proc_app_info memory strucutre before updating 49/314849/1 accepted/tizen/8.0/unified/20240724.010423
authorUnsung Lee <unsung.lee@samsung.com>
Mon, 22 Jul 2024 05:25:51 +0000 (14:25 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Mon, 22 Jul 2024 05:54:48 +0000 (14:54 +0900)
Initaliize proc_app_info memory structure before updating the structure.
Currently, proc_app_info memory structure is updated before initalizing the structure.
After then, Initalization is done, so oom_score_adj of proc_app_info memory
is overwritten as wrong value.

Change-Id: Id545677f9982eb615636a9a992facc64f73d321f
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/process/proc-main.c

index ed4a19e..a619ccc 100644 (file)
@@ -938,6 +938,12 @@ __attribute__((weak)) struct proc_app_info *proc_create_app_info(const char *app
                pai->categories = categories;
 
        if (pid > 0) {
+               proc_set_process_memory_state(pai, MEMCG_TOP, NULL, OOMADJ_APP_MAX + 10);
+               pai->memory.use_mem_limit = false;
+               pai->memory.oom_killed = false;
+               pai->memory.memlimit_update_exclude = false;
+               pai->memory.foreground_oom_score_adj = OOMADJ_APP_MAX + 10;
+
                pai->program = proc_add_program_list(type, pai, pkgid, false);
                if (!pai->starttime) {
                        ret = proc_get_uptime(&uptime);
@@ -946,11 +952,6 @@ __attribute__((weak)) struct proc_app_info *proc_create_app_info(const char *app
                        else
                                pai->starttime = uptime;
                }
-               proc_set_process_memory_state(pai, MEMCG_TOP, NULL, OOMADJ_APP_MAX + 10);
-               pai->memory.use_mem_limit = false;
-               pai->memory.oom_killed = false;
-               pai->memory.memlimit_update_exclude = false;
-               pai->memory.foreground_oom_score_adj = OOMADJ_APP_MAX + 10;
 
                if (fixed_app_list_get()) {
                        int error;