proc-main: Revert update oom score of service app launch 31/302831/3
authorUnsung Lee <unsung.lee@samsung.com>
Thu, 30 Nov 2023 02:33:08 +0000 (11:33 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Thu, 28 Dec 2023 09:35:52 +0000 (18:35 +0900)
Revert update oom score when service app is launched. It is process
to revert functionality of resourced 6.0.

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

index 7eb1f2c..ed4a19e 100644 (file)
@@ -643,6 +643,16 @@ static void proc_set_default_svc_oomscore
        }
 
        proc_set_service_oomscore(svc->main_pid, oom_score_adj, svc);
+
+       /* The svc->memory.oom_score_adj should have been updated by the
+        * subroutine of proc_set_service_oomscore(). But at this stage,
+        * the proc_app_info of service app is not added to the app list. As a
+        * result the subroutine cannot update proc_app_info of a service app.
+        * Therefore, manually update oom_score_adj of service app. */
+       retval = proc_get_oom_score_adj(svc->main_pid, &oom_score_adj);
+       if (retval == RESOURCED_ERROR_NONE)
+               svc->memory.oom_score_adj = oom_score_adj;
+
 }
 
 static struct proc_program_info *proc_add_program_list(const int type,
@@ -679,6 +689,8 @@ static struct proc_program_info *proc_add_program_list(const int type,
                ppi->app_list = g_slist_prepend(ppi->app_list, pai);
        else {
                ppi->svc_list = g_slist_prepend(ppi->svc_list, pai);
+               if (!restore)
+                       proc_set_default_svc_oomscore(ppi, pai);
        }
        return ppi;
 }
@@ -1776,8 +1788,6 @@ int resourced_proc_status_change(int status, pid_t pid, char *app_name, char *pk
                if (!ps.pai)
                        break;
 
-               proc_set_default_svc_oomscore(ps.pai->program, ps.pai);
-
                resourced_notify(RESOURCED_NOTIFIER_SERVICE_LAUNCH, &ps);
                if (!(CHECK_BIT(ps.pai->flags, PROC_BGCTRL_APP)) ||
                    ps.pai->categories)