proc-main: Init proc_app_info memory strucutre before updating 68/314868/2 accepted/tizen/7.0/unified/20240724.012955
authorUnsung Lee <unsung.lee@samsung.com>
Mon, 22 Jul 2024 09:02:15 +0000 (18:02 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Mon, 22 Jul 2024 10:14:49 +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: Id10d30a9c972b5012810eb5c89d91fad800ecc23
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/process/proc-main.c

index 094c7f044f779f1d2259d6a5f941951ce8ceba02..6690597796fdccba431051117cf7d69addb93360 100644 (file)
@@ -808,6 +808,11 @@ __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->program = proc_add_program_list(type, pai, pkgid, false);
                if (!pai->starttime) {
                        ret = proc_get_uptime(&uptime);
@@ -816,10 +821,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;
 
                if (fixed_app_list_get()) {
                        int error;