If DLOG and DB type, then <type> is 5 (0x01 | 0x04).
Example: logging=5
-5. proc.conf
-============
-
-5.1 OOM_FIXED_APPS
-==================
-Key: <app name>
-Value: <oom_score_adj>
-Comment: Specify the oom_score_adj.
- oom_score_adj is an integer value between -900 to 250.
- Predefined values cannot be used.
- Predefined values are: -900, 0, 100, 150, 200, 230, 250
- (Please refer to procfs.h)
-Example: org.tizen.homescreen-efl=-99
-
-6. limiter.conf.d/*.conf
+5. limiter.conf.d/*.conf
========================
-6.1 Section: Private
+5.1 Section: Private
====================
Key: App|Service|SERVICE|Process|PROCESS
Value: <name>
If (no|0|off), disable cpu throttling.
Example: CpuThrottling=yes
-7. optimizer.conf.d/*.conf
+6. optimizer.conf.d/*.conf
==========================
-7.1 Section: Private
+6.1 Section: Private
====================
Key: App|Service|SERVICE|Process|PROCESS
Value: <name>
Comment: Specify the cpu affinity of this app
Example: CpuAffinity=1,3-5,8
-8. process.conf.d/*.conf
+7. process.conf.d/*.conf
========================
-8.1 Section: Private
+7.1 Section: Private
====================
Key: App|Service|SERVICE|Process|PROCESS
Value: <name>
<action> can be: ignore, kill
Example: WatchdogAction=ignore
-9. vip-process.d/*.conf
+Key: OomScore
+Value: <oom_score_adj>
+Comment: Specify the oom_score_adj.
+ oom_score_adj is an integer value between -900 to 250.
+ Predefined values cannot be used.
+ Predefined values are: -900, 0, 100, 150, 200, 230, 250
+ (Please refer to procfs.h)
+Example: OomScore=125
+
+8. vip-process.d/*.conf
=======================
-9.1 Section: Private|VIP_GROUP
+8.1 Section: Private|VIP_GROUP
==============================
Key: App|Service|SERVICE|Process|PROCESS
Value: <name>
#include "dedup-common.h"
#include "compact-common.h"
#include "cpu-common.h"
+#include "procfs.h"
#define MAX_SECTION 64
pci->watchdog_action = PROC_ACTION_KILL;
pci->fail_action = PROC_ACTION_IGNORE;
pci->cpu_boosting_level = CPU_BOOSTING_LEVEL_NONE;
+ pci->oom_score = OOMADJ_APP_MAX + 10;
strncpy(pci->name, result->value, sizeof(pci->name)-1);
if (result->name[0] == 'A')
}
pci->cpu_sched_info.rt_period_us = config_parse_time_us(result->value);
}*/
+ else if (!strncmp(result->name, OOM_SCORE_NAME_CONF, strlen(OOM_SCORE_NAME_CONF) + 1)
+ && *config_type == PROCESS_CONFIG) {
+ if (!pci) {
+ _E("process configuration information pointer should not be NULL");
+ return RESOURCED_ERROR_FAIL;
+ }
+
+ int oom_score = atoi(result->value);
+ if (oom_score < OOMADJ_SERVICE_MIN || oom_score > OOMADJ_APP_MAX) {
+ _E("invalid parameter (oom_score = %d)", oom_score);
+ return RESOURCED_ERROR_INVALID_PARAMETER;
+ }
+
+ pci->oom_score = oom_score;
+ }
else if (!strncmp(result->name, ACTION_ON_FAILURE_NAME_CONF,
strlen(ACTION_ON_FAILURE_NAME_CONF)+1) && *config_type == PROCESS_CONFIG) {
if (!pci) {
#include "resourced.h"
#include "trace.h"
-#define PRIORITY_CONF_FILE RD_CONFIG_FILE(proc)
-
-#define FIXED_OOM_CONF_SECTION "OOM_FIXED_APPS"
-
#define FIXED_OOM_MIN OOMADJ_SERVICE_MIN
#define FIXED_OOM_MAX OOMADJ_BACKGRD_LOCKED
-static GHashTable *oom_fixed_app_list;
static GHashTable *oom_fixed_pid_list;
static int proc_oom_priority_set_fixed_oom(void *data)
{
int ret;
- int *fixed_oom = NULL;
- gint *key, *val;
+ int *fixed_oom_score = NULL;
+ gint *pid, *oom_score;
struct proc_status *ps = (struct proc_status *)data;
if (!ps)
return RESOURCED_ERROR_INVALID_PARAMETER;
- fixed_oom = (int *)g_hash_table_lookup(oom_fixed_app_list, ps->pai->appid);
+ struct proc_conf_info *pci = fixed_app_and_service_exist_check(ps->pai->appid, APP_TYPE);
+ /* This app is not interested in the fixed oom configuration */
+ if (!pci || pci->oom_score > OOMADJ_APP_MAX)
+ return RESOURCED_ERROR_NONE;
/* Make another hashtable for fast searching during proc_set_oom_score_adj */
- if (fixed_oom) {
- ret = proc_set_oom_score_adj(ps->pid, *fixed_oom, ps->pai);
- if (ret != RESOURCED_ERROR_NONE) {
- _E("Failed to set the fixed oom for %s", ps->pai->appid);
- return ret;
- }
-
- _D("Set the fixed oom of %s with %d", ps->pai->appid, *fixed_oom);
- key = g_new(gint, 1);
- val = g_new(gint, 1);
- *key = ps->pid;
- *val = *fixed_oom;
- g_hash_table_insert(oom_fixed_pid_list, (gpointer)key, (gpointer)val);
+ fixed_oom_score = &pci->oom_score;
+ ret = proc_set_oom_score_adj(ps->pid, *fixed_oom_score, ps->pai);
+ if (ret != RESOURCED_ERROR_NONE) {
+ _E("Failed to set the fixed oom for %s", ps->pai->appid);
+ return ret;
}
+ _D("Set the fixed oom of %s with %d", ps->pai->appid, *fixed_oom_score);
+ pid = g_new(gint, 1);
+ oom_score = g_new(gint, 1);
+ *pid = ps->pid;
+ *oom_score = *fixed_oom_score;
+ g_hash_table_insert(oom_fixed_pid_list, (gpointer)pid, (gpointer)oom_score);
+
return RESOURCED_ERROR_NONE;
}
return g_hash_table_contains(oom_fixed_pid_list, &pid);
}
-static int load_fixed_oom_config(struct parse_result *result, void *user_data)
+static int load_fixed_oom_config(void)
{
int score;
- gint *fixed_oom;
+ gpointer app_name;
+ gpointer proc_conf_ptr;
+ GHashTableIter app_list_iter;
- if (!result)
- return RESOURCED_ERROR_INVALID_PARAMETER;
+ g_hash_table_iter_init(&app_list_iter, fixed_app_list_get());
+ while (g_hash_table_iter_next(&app_list_iter, &app_name, &proc_conf_ptr)) {
+ struct proc_conf_info *pci = (struct proc_conf_info *)proc_conf_ptr;
+
+ if (!pci) {
+ _W("[CPU-SCHED] Process configuration information is NULL");
+ continue;
+ }
- if (!strncmp(result->section, FIXED_OOM_CONF_SECTION, strlen(FIXED_OOM_CONF_SECTION) + 1)) {
- /* Set predefined OOM score */
- score = atoi(result->value);
+ score = pci->oom_score;
+ if (score > OOMADJ_APP_MAX)
+ continue;
switch (score) {
case OOMADJ_SERVICE_MIN:
case OOMADJ_FOREGRD_UNLOCKED:
case OOMADJ_BACKGRD_PERCEPTIBLE:
case OOMADJ_BACKGRD_LOCKED:
- _E("You can't set the fixed oom for %s with predefined value %d", result->name, score);
- return RESOURCED_ERROR_INVALID_PARAMETER;
+ _W("You can't set the fixed oom for %s with predefined value %d", pci->name, score);
+ pci->oom_score = OOMADJ_APP_MAX + 10;
+ break;
default:
if (score < FIXED_OOM_MIN || score > FIXED_OOM_MAX) {
- _E("You can't set the fixed oom for %s with the out of range %d", result->name, score);
- return RESOURCED_ERROR_INVALID_PARAMETER;
+ _W("You can't set the fixed oom for %s with the out of range %d", pci->name, score);
+ pci->oom_score = OOMADJ_APP_MAX + 10;
}
}
-
- fixed_oom = g_new(gint, 1);
- *fixed_oom = score;
- g_hash_table_insert(oom_fixed_app_list,
- g_strndup(result->name, strlen(result->name)),
- (gpointer)fixed_oom);
}
return RESOURCED_ERROR_NONE;
static int proc_oom_priority_init(void *data)
{
- oom_fixed_app_list = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
oom_fixed_pid_list = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free);
- g_assert(oom_fixed_app_list && oom_fixed_pid_list);
+ g_assert(oom_fixed_pid_list);
- config_parse(PRIORITY_CONF_FILE, load_fixed_oom_config, NULL);
+ load_fixed_oom_config();
register_notifier(RESOURCED_NOTIFIER_APP_LAUNCH, proc_oom_priority_set_fixed_oom);
register_notifier(RESOURCED_NOTIFIER_APP_TERMINATED, proc_oom_priority_remove_pid);
static int proc_oom_priority_exit(void *data)
{
- if (oom_fixed_app_list)
- g_hash_table_destroy(oom_fixed_app_list);
if (oom_fixed_pid_list)
g_hash_table_destroy(oom_fixed_pid_list);
unregister_notifier(RESOURCED_NOTIFIER_APP_LAUNCH, proc_oom_priority_set_fixed_oom);