static void proc_set_default_svc_oomscore
(struct proc_program_info *ppi, struct proc_app_info *svc)
{
- struct proc_app_info *pai =
- (struct proc_app_info *)g_slist_nth_data(ppi->app_list, 0);
- int oom_score_adj = 0, ret ;
+ struct proc_app_info *pai = (struct proc_app_info *)g_slist_nth_data(ppi->app_list, 0);
+ int retval;
+ int oom_score_adj = 0;
+
if (pai) {
if (CHECK_BIT(pai->flags, PROC_VIP_ATTRIBUTE))
oom_score_adj = OOMADJ_SU;
else {
- ret = proc_get_oom_score_adj(pai->main_pid, &oom_score_adj);
- if (ret)
+ retval = proc_get_oom_score_adj(pai->main_pid, &oom_score_adj);
+ if (retval != RESOURCED_ERROR_NONE)
oom_score_adj = 0;
}
}
+
proc_set_service_oomscore(svc->main_pid, oom_score_adj);
+
+ /* 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,