From a6e279e81641bce48eab8f2f5089792a0cdb8395 Mon Sep 17 00:00:00 2001 From: Unsung Lee Date: Thu, 7 Sep 2023 12:05:33 +0900 Subject: [PATCH] conf: Add governor (post) configurations Add memory (LMK) and cpu (boosting stall) governor configurations to turn on/off options. Two new section is added like below: - MemoryLMKGovernor in limiter.conf : LMK post governor related section - CpuBoostingStallGovernor in optimizer.conf : Cpu boosting stall governor related section MemoryLMKGovernor includes configurations - ForegroundAppListPostGovernor: LMK post governor for foreground app list - WorkingSetSizePostGovernor: LMK post governor for working set size CpuBoostingStallGovernor includes a configuration - CpuBoostingStallGovernor: Cpu boosting governor for stall handler Change-Id: I901915bc6d80b66256466a54d56e9216d80f5737 Signed-off-by: Unsung Lee --- conf/README | 24 +++++++++++++++++++++++- conf/limiter.conf | 4 ++++ conf/optimizer.conf | 3 +++ src/common/conf/config-parser.c | 28 ++++++++++++++++++++++++++++ src/common/conf/config-parser.h | 5 +++++ 5 files changed, 63 insertions(+), 1 deletion(-) diff --git a/conf/README b/conf/README index c8a770e..d36c8ea 100644 --- a/conf/README +++ b/conf/README @@ -106,7 +106,21 @@ Comment: Specify the memory limitation of background apps. can be: broadcast, reclaim, kill, ignore Example: BackgroundPerAppLimitAction=768MB,kill -1.5 Section: CpuThrottling +1.5 Section: MemoryLMKGovernor +============================= +Key: ForegroundAppListPostGovernor +Value: (yes|1|ok|on|no|0|off) +Comment: Specify whether LMK foregroud app list post governor is turned on or not. + If (yes|1|ok|on), rearrange LMK victim list according to the post governor. + If (no|0|off), skip the corresponding post governor. + +Key: WorkingSetSizePostGovernor +Value: (yes|1|ok|on|no|0|off) +Comment: Specify whether LMK working set size post governor is turned on or not. + 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 ========================== Key: CpuSched Value: @@ -340,6 +354,14 @@ Comment: Specify the cpu rt priority when the cpu boosting level is "weak". is an decimal integer value. Example: CpuRTPriority=50 +2.12 Section: CpuBoostingStallGovernor +====================================== +Key: CpuBoostingStallGovernor +Value: (yes|1|ok|on|no|0|off) +Comment: Specify whether cpu boosting stall governor is turned on or not. + If (yes|1|ok|on), decrease cpu boosting level according to the governor rule. + If (no|0|off), skip the corresponding governor. + 3. monitor.conf =============== diff --git a/conf/limiter.conf b/conf/limiter.conf index bd491b6..e4deba0 100644 --- a/conf/limiter.conf +++ b/conf/limiter.conf @@ -16,6 +16,10 @@ ServicePerAppLimitAction=128MB,kill [MemoryThrottling] ThrottlingLimit= 80% +[MemoryLMKGovernor] +ForegroundAppListPostGovernor=no +WorkingSetSizePostGovernor=no + [CpuThrottling] #CpuSched=idle #CpuNice=19 diff --git a/conf/optimizer.conf b/conf/optimizer.conf index 24ec2d7..9a1f125 100644 --- a/conf/optimizer.conf +++ b/conf/optimizer.conf @@ -44,3 +44,6 @@ CpuRTPriority=1 [CpuBoostingLevelWeak] CpuSched=other CpuNice=-20 # Priority=100 + +[CpuBoostingStallGovernor] +CpuBoostingStallGovernor=no diff --git a/src/common/conf/config-parser.c b/src/common/conf/config-parser.c index e65dd9d..b476933 100644 --- a/src/common/conf/config-parser.c +++ b/src/common/conf/config-parser.c @@ -32,6 +32,7 @@ #include "compact-common.h" #include "cpu-common.h" #include "procfs.h" +#include "memory-common.h" #define MAX_SECTION 64 @@ -659,6 +660,13 @@ static int optimizer_config(struct parse_result *result, void *user_data) _E("[CONFIG] Unknown configuration name (%s) and value (%s) on section (%s)", result->name, result->value, result->section); } + } else if (!strncmp(result->section, CPU_BOOSTING_STALL_GOVERNOR_SECTION, + strlen(CPU_BOOSTING_STALL_GOVERNOR_SECTION) + 1)) { + if (!strncmp(result->name, CPU_BOOSTING_STALL_GOVERNOR_NAME_CONF, + strlen(CPU_BOOSTING_STALL_GOVERNOR_NAME_CONF) + 1)) { + if (config_parse_bool(result->value)) + cpu_boosting_enable_cpu_stall_handler(); + } } else { _E("[CONFIG] Unknown section name (%s) and value (%s) on section (%s)", @@ -800,6 +808,26 @@ static int limiter_config(struct parse_result *result, void *user_data) return error; } + else if (!strncmp(result->section, MEMORY_LMK_GOVERNOR_SECTION, + strlen(MEMORY_LMK_GOVERNOR_SECTION) + 1)) { + int error = RESOURCED_ERROR_NONE; + + if (!strncmp(result->name, FOREGROUND_APP_LIST_POST_GOVERNOR_NAME_CONF, + strlen(FOREGROUND_APP_LIST_POST_GOVERNOR_NAME_CONF) + 1)) { + if (config_parse_bool(result->value)) + proc_enable_foreground_app_list_status(); + } else if (!strncmp(result->name, WORKING_SET_SIZE_POST_GOVERNOR_NAME_CONF, + strlen(WORKING_SET_SIZE_POST_GOVERNOR_NAME_CONF) + 1)) { + if (config_parse_bool(result->value)) + lmk_governor_post_enable_wss(); + } else { + _E("[CONFIG] Unknown configuration name (%s) and value (%s) " + "on section (%s)", + result->name, result->value, result->section); + } + + return error; + } else if (!strncmp(result->section, CPU_THROTTLING_SECTION, strlen(CPU_THROTTLING_SECTION)+1)) { if (!cpu_throttling_conf->enable) diff --git a/src/common/conf/config-parser.h b/src/common/conf/config-parser.h index 3c40c0d..caec857 100644 --- a/src/common/conf/config-parser.h +++ b/src/common/conf/config-parser.h @@ -49,6 +49,7 @@ extern "C" { #define MEMORY_APP_TYPE_LIMIT_SECTION "MemoryAppTypeLimit" #define MEMORY_APP_STATUS_LIMIT_SECTION "MemoryAppStatusLimit" #define MEMORY_THROTTLING_SECTION "MemoryThrottling" +#define MEMORY_LMK_GOVERNOR_SECTION "MemoryLMKGovernor" #define CPU_THROTTLING_SECTION "CpuThrottling" #define OLD_VIP_GROUP_SECTION "VIP_GROUP" @@ -64,6 +65,7 @@ extern "C" { #define CPU_BOOSTING_LEVEL_STRONG_SECTION "CpuBoostingLevelStrong" #define CPU_BOOSTING_LEVEL_MEDIUM_SECTION "CpuBoostingLevelMedium" #define CPU_BOOSTING_LEVEL_WEAK_SECTION "CpuBoostingLevelWeak" +#define CPU_BOOSTING_STALL_GOVERNOR_SECTION "CpuBoostingStallGovernor" /* process.conf */ #define FOREGROUND_APP_LIST_SECTION "ForegroundAppList" @@ -92,6 +94,8 @@ extern "C" { #define WIDGET_PER_APP_LIMIT_ACTION_NAME_CONF "WidgetPerAppLimitAction" #define GUI_PER_APP_LIMIT_ACTION_NAME_CONF "GUIPerAppLimitAction" #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" /* CPU specific configuration name */ #define CPU_SCHED_NAME_CONF "CpuSched" @@ -126,6 +130,7 @@ extern "C" { #define FRAG_LEVEL_NAME_CONF "FragLevel" #define FOREGROUND_APPS_NAME_CONF "ForegroundApps" #define CPU_AFFINITY_NAME_CONF "CpuAffinity" +#define CPU_BOOSTING_STALL_GOVERNOR_NAME_CONF "CpuBoostingStallGovernor" /* configuration value */ #define CGROUP_LOW_VALUE_CONF "lowest" -- 2.7.4