proc-main: Init proc_app_info memory strucutre before updating 67/314867/2 accepted/tizen/unified/20240723.034827 accepted/tizen/unified/dev/20240724.110046 accepted/tizen/unified/x/20240723.090004
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 10:14:00 +0000 (19:14 +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;