Add 'MemoryLimitTrigger' conf to support oom based event trigger and handler.
If conf value is oom then, memory limit is handled by kernel oom. On the other hand,
reosurced handles memory limit directly with threshold value in the conf.
Change-Id: I785fc8bdac9505f990dc48cf3c4c7d4ead013c01
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
If (yes|1|ok|on), rearrange LMK victim list according to the post governor.
If (no|0|off), skip the corresponding post governor.
-1.6 Section: CpuThrottling
+1.6 Section: MemoryLimitTrigger
+===============================
+Key: MemoryLimitTrigger
+Value: oom or threshold or others
+Comment: Specify the type of memory limit trigger type.
+ oom: If memory usage reaches limit, then cgroup oom will handle the situation.
+ threshold: If memory usage reaches limit, then resourced will kill the target without page reclaim.
+ others: If 'MemLimit(Action)' is turned on, just set memory limit.
+Example: MemoryLimitTrigger=oom
+
+1.7 Section: CpuThrottling
==========================
Key: CpuSched
Value: <schedule scheme>
ForegroundAppListPostGovernor=no
WorkingSetSizePostGovernor=no
+[MemoryLimitTrigger]
+MemoryLimitTrigger=oom
+#MemoryLimitTrigger=threshold
+#MemoryLimitTrigger=others
+
[CpuThrottling]
#CpuSched=idle
#CpuNice=19
MEMCG_END,
};
+enum memcg_limit_trigger {
+ MEMCG_TRIGGER_NONE,
+ MEMCG_TRIGGER_OOM,
+ MEMCG_TRIGGER_THRESHOLD,
+ MEMCG_TRIGGER_MAX,
+};
+
struct mem_threshold {
bool percent;
int threshold; /* MB or % */
struct mem_action background;
float cgroup_limit[MEMCG_END]; /* % */
bool oom_popup;
+ enum memcg_limit_trigger limit_trigger;
};
struct memcg_info {
return CPU_BOOSTING_LEVEL_NONE;
}
+static enum memcg_limit_trigger parse_limit_trigger_type(const char *value)
+{
+
+ if (!strncmp(value, MEMORY_LIMIT_TRIGGER_OOM_VALUE_CONF,
+ strlen(MEMORY_LIMIT_TRIGGER_OOM_VALUE_CONF) + 1)) {
+ return MEMCG_TRIGGER_OOM;
+ }
+ else if (!strncmp(value, MEMORY_LIMIT_TRIGGER_THRESHOLD_VALUE_CONF,
+ strlen(MEMORY_LIMIT_TRIGGER_THRESHOLD_VALUE_CONF) + 1)) {
+ return MEMCG_TRIGGER_THRESHOLD;
+ }
+
+ return MEMCG_TRIGGER_NONE;
+}
+
/* Create a single cpu_info struct representation */
static int cpu_sched_new_cpu_info(struct cpuset_info *set, int cpu_id)
{
return error;
}
+ else if (!strncmp(result->section, MEMORY_LIMIT_TRIGGER_SECTION,
+ strlen(MEMORY_LIMIT_TRIGGER_SECTION ) + 1)) {
+ if (!strncmp(result->name, MEMORY_LIMIT_TRIGGER_NAME_CONF,
+ strlen(MEMORY_LIMIT_TRIGGER_NAME_CONF ) + 1)) {
+ memcg_conf->limit_trigger = parse_limit_trigger_type(result->value);
+ }
+ else {
+ _E("[CONFIG] Unknown configuration name (%s) and value (%s) on section (%s)",
+ result->name, result->value, result->section);
+ }
+ }
else if (!strncmp(result->section, CPU_THROTTLING_SECTION,
strlen(CPU_THROTTLING_SECTION)+1)) {
if (!cpu_throttling_conf->enable)
#define MEMORY_LMK_GOVERNOR_SECTION "MemoryLMKGovernor"
#define MEMORY_BACKGROUND_LRU_SECTION "MemoryBackgroundLru"
#define CPU_THROTTLING_SECTION "CpuThrottling"
+#define MEMORY_LIMIT_TRIGGER_SECTION "MemoryLimitTrigger"
#define OLD_VIP_GROUP_SECTION "VIP_GROUP"
/* optimizer.conf */
#define BACKGROUND_PER_APP_LIMIT_ACTION_NAME_CONF "BackgroundPerAppLimitAction"
#define FOREGROUND_APP_LIST_POST_GOVERNOR_NAME_CONF "ForegroundAppListPostGovernor"
#define WORKING_SET_SIZE_POST_GOVERNOR_NAME_CONF "WorkingSetSizePostGovernor"
+#define MEMORY_LIMIT_TRIGGER_NAME_CONF "MemoryLimitTrigger"
/* CPU specific configuration name */
#define CPU_SCHED_NAME_CONF "CpuSched"
#define ACTION_REBOOT_VALUE_CONF "reboot"
#define ACTION_IGNORE_VALUE_CONF "ignore"
+/* Memory specific configuration name */
+#define MEMORY_LIMIT_TRIGGER_OOM_VALUE_CONF "oom"
+#define MEMORY_LIMIT_TRIGGER_THRESHOLD_VALUE_CONF "threshold"
+
/* CPU specific configuration name */
#define RT_RUNTIME_SHARE_VALUE_CONF "rt_runtime_share"
#define NO_RT_RUNTIME_SHARE_VALUE_CONF "no_rt_runtime_share"