conf: Add LmkMaxVictimPerOom to set max victim per oom level during LMK 54/302754/3
authorUnsung Lee <unsung.lee@samsung.com>
Fri, 17 Nov 2023 11:29:00 +0000 (20:29 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Thu, 28 Dec 2023 09:30:01 +0000 (18:30 +0900)
Add LmkMaxVictimPerOom to set max victim per oom level during LMK.
It is restoration of 'NumMaxVictims' in tizen 6.0.

Change-Id: I3771d00e1d3f847072039e553d9f8ce3aae1146a
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
conf/README
conf/limiter.conf
src/common/cgroup/memory-cgroup.h
src/common/conf/config-parser.c
src/common/conf/config-parser.h
src/resource-limiter/memory/lowmem.c

index cf12bd2..cef1836 100644 (file)
@@ -81,6 +81,11 @@ Value: <threshold>[GMK]B
 Comment: Specify the threshold or ratio for LMK stop.
 Example: LmkThresholdLeave=160MB
 
+Key: LmkMaxVictimPerOom
+Value: <the number of max victims>
+Comment: Specify the max victims per oom level during LMK.
+Example: LmkMaxVictimPerOom=10
+
 1.3 Section: MemoryAppTypeLimit
 ===============================
 Key: ServicePerAppLimitAction
index b0dfe1d..3eb9b4c 100644 (file)
@@ -4,6 +4,7 @@ LowLevel=          15%
 CriticalLevel=     10%
 OomLevel=           7%
 LmkThresholdLeave= 14%
+LmkMaxVictimPerOom= 10
 OomPopup=           no
 
 [MemoryAppTypeLimit]
index f28afbb..52a0791 100644 (file)
@@ -176,6 +176,7 @@ struct memcg_conf {
        bool oom_popup;
        enum memcg_limit_trigger limit_trigger;
        struct mem_threshold threshold_leave;
+       int lmk_max_victim_per_oom;
 };
 
 struct memcg_info {
index a4fe1df..ab84139 100644 (file)
@@ -751,8 +751,10 @@ static int limiter_config(struct parse_result *result, void *user_data)
                if (!strncmp(result->name, OOM_POPUP_NAME_CONF,
                                        strlen(OOM_POPUP_NAME_CONF) + 1)) {
                        memcg_conf->oom_popup = config_parse_bool(result->value);
-               }
-               else {
+               } else if (!strncmp(result->name, MEMORY_LMK_MAX_VICTIM_PER_OOM_NAME_CONF,
+                                       strlen(MEMORY_LMK_MAX_VICTIM_PER_OOM_NAME_CONF) + 1)) {
+                       memcg_conf->lmk_max_victim_per_oom = atoi(result->value);
+               } else {
                        char temp = '\0';
                        int error = RESOURCED_ERROR_NONE;
                        bool percent;
index 1a82e5b..f7c3249 100644 (file)
@@ -101,6 +101,7 @@ extern "C" {
 #define MEMORY_LIMIT_TRIGGER_NAME_CONF               "MemoryLimitTrigger"
 #define MEMORY_LMK_KILL_EXCEPTION_NAME_CONF          "LmkKillException"
 #define MEMORY_LMK_THRESHOLD_LEAVE_NAME_CONF         "LmkThresholdLeave"
+#define MEMORY_LMK_MAX_VICTIM_PER_OOM_NAME_CONF      "LmkMaxVictimPerOom"
 
 /* CPU specific configuration name */
 #define CPU_SCHED_NAME_CONF                          "CpuSched"
index 1ef02d4..72fd233 100644 (file)
@@ -1625,6 +1625,9 @@ static void load_configs(void)
                                memcg_conf->threshold_leave.threshold);
        }
 
+       if (memcg_conf->lmk_max_victim_per_oom > 0)
+               num_max_victims = memcg_conf->lmk_max_victim_per_oom;
+
        oom_popup_enable = memcg_conf->oom_popup;
        set_memcg_limit_trigger(memcg_conf->limit_trigger);