From 66dd7d5b474c7745a6a47bae87314468d85ddca0 Mon Sep 17 00:00:00 2001 From: Unsung Lee Date: Fri, 4 Feb 2022 18:22:04 +0900 Subject: [PATCH] Modify configurations delete old style configuration files and create new configuration files Change-Id: I11e0cf2d9856f41aea81675b880271d4abd16143 Signed-off-by: Unsung Lee --- CMakeLists.txt | 1 + conf/README | 454 +++++++++++++++++++++ conf/block.conf | 10 - conf/cpu-sched.conf | 1 - conf/cpu.conf | 15 - conf/dedup.conf | 38 -- conf/limiter-profile-iot-headless.conf | 81 ++++ conf/limiter-profile-tv.conf | 54 +++ conf/limiter.conf | 52 +++ conf/memory-profile-iot-headless.conf | 237 ----------- conf/memory-profile-tv.conf | 168 -------- conf/memory.conf | 237 ----------- conf/{heart.conf => monitor.conf} | 2 - conf/optimizer.conf | 42 ++ conf/process.conf | 19 +- conf/swap.conf | 33 -- packaging/resourced.spec | 31 +- src/CMakeLists.txt | 26 +- src/common/cgroup/cgroup.h | 3 + src/common/cgroup/memory-cgroup.c | 1 - src/common/config-parser.c | 6 +- src/common/dedup-common.h | 2 +- src/common/swap-common.h | 2 +- src/process/block/block.c | 6 +- src/process/priority/proc-priority.c | 3 +- src/process/vip/vip-process.c | 21 +- src/resource-limiter/cpu/cpu-sched.c | 6 +- src/resource-limiter/cpu/cpu.c | 10 +- src/resource-limiter/memory/lowmem-limit.c | 4 +- .../memory/vmpressure-lowmem-handler.c | 254 ++++++++---- src/resource-monitor/battery/heart-battery.c | 9 +- src/resource-monitor/heart.c | 2 +- src/resource-monitor/heart.h | 2 +- .../memory/compaction}/compaction.c | 15 +- src/resource-optimizer/memory/dedup/dedup.c | 42 +- src/resource-optimizer/memory/swap/zramswap.c | 4 +- 36 files changed, 973 insertions(+), 920 deletions(-) create mode 100644 conf/README delete mode 100644 conf/block.conf delete mode 100644 conf/cpu-sched.conf delete mode 100644 conf/cpu.conf delete mode 100644 conf/dedup.conf create mode 100644 conf/limiter-profile-iot-headless.conf create mode 100644 conf/limiter-profile-tv.conf create mode 100644 conf/limiter.conf delete mode 100644 conf/memory-profile-iot-headless.conf delete mode 100644 conf/memory-profile-tv.conf delete mode 100644 conf/memory.conf rename conf/{heart.conf => monitor.conf} (91%) create mode 100644 conf/optimizer.conf delete mode 100644 conf/swap.conf rename src/{resource-limiter/memory => resource-optimizer/memory/compaction}/compaction.c (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c30bd5..b8b205f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ SET(RESOURCE_OPTIMIZER_SOURCE_DIR ${SOURCE_DIR}/resource-optim SET(MEMORY_RESOURCE_OPTIMIZER_SOURCE_DIR ${RESOURCE_OPTIMIZER_SOURCE_DIR}/memory) SET(DEDUP_SOURCE_DIR ${RESOURCE_OPTIMIZER_SOURCE_DIR}/memory/dedup) SET(SWAP_SOURCE_DIR ${RESOURCE_OPTIMIZER_SOURCE_DIR}/memory/swap) +SET(COMPACTION_SOURCE_DIR ${RESOURCE_OPTIMIZER_SOURCE_DIR}/memory/compaction) #resource-limiter source folders SET(RESOURCE_LIMITER_SOURCE_DIR ${SOURCE_DIR}/resource-limiter) diff --git a/conf/README b/conf/README new file mode 100644 index 0000000..9ab1b08 --- /dev/null +++ b/conf/README @@ -0,0 +1,454 @@ +Resourced Configurations +======================== + +File Names +========== +1. limiter.conf : configurations to limit resources +2. optimizer.conf : configurations to optimize resources +3. monitor.conf : configurations to monitor resources +4. process.conf : configurations to manage process + +Sections +======== +Section name should be located between '[' and ']'. +The order between sections does not matter and +the order of configurations within a section is also not important. + +1. limiter.conf +=============== + +1.1 VIP_PROCESS +=============== +Format: PREDEFINE= +Comment: add vip processes in this section. + these processes will be located in the VIP cgroup (maximum cpu and memory) and + they won't be killed by a low memory killer(LMK). +ex)PREDEFINE=app1 + PREDEFINE=app2 + +1.2 OOM_FIXED_APPS +================== +Format: APP NAME= +Comment: add app names with their oom_score_adjs in this section. + do not set the score with the predefined scores described at the procfs.h. + the range of SCORE should be OOMADJ_SERVICE_MIN < SCORE < OOMADJ_BACKGRD_LOCKED +ex)app1=323 + app2=415 + +1.3 Memory +========== +Format: ThresholdDedup= +Comment: specify threshold(MB) of dedup level +ex)ThresholdDedup=30 + +Format: ThresholdSwap= +Comment: specify threshold(MB) of swap level +ex)ThresholdSwap=20 + +Format: ThresholdLow= +Comment: specify threshold(MB) of low level +ex)ThresholdLow=15 + +Format: ThresholdMedium= +Comment: specify threshold(MB) of medium level +ex)ThresholdMedium=10 + +Format: ThresholdLeave= +Comment: specify threshold leave of medium level +ex)ThresholdLeave=20 + +Format: ThresholdRatioDedup= +Comment: specify threshold ratio(%) of dedup level +ex)ThresholdRatioDedup=30 + +Format: ThresholdRatioSwap= +Comment: specify threshold ratio(%) of swap level +ex)ThresholdRatioSwap=25 + +Format: ThresholdRatioLow= +Comment: specify threshold ratio(%) of low level +ex)ThresholdRatioLow=20 + +Format: ThresholdRatioMedium= +Comment: specify threshold ratio(%) of medium level +ex)ThresholdRatioMedium=15 + +Format: ThresholdRatioLeave= +Comment: specify threshold leave ratio(%) of medium level +ex)ThresholdRatioLeave=30 + +Format: ForegroundRatio= +Comment: specify memory limit ratio(0.0<= ratio <=1.0) of foreground apps(High cgroup) +ex)ForegroundRatio=0.3 + +Format: BackgroundRatio= +Comment: specify memory limit ratio(0.0<= ratio <=1.0) of background apps(Medium cgroup). + Unset this option if it causes any unexepcted issue (e.g. jerky animation). +ex)BackgroundRatio=0.2 + +Format: LowRatio= +Comment: specify memory limit ratio(0.0<= ratio <=1.0) of old background apps(Lowest cgroup) +ex)LowRatio=0.1 + +Format: NumMaxVictims=<#victim> +Comment: specify the number of victims +ex)NumMaxVictims=10 + +Format: ProactiveThreshold= +Comment: specify threshold(MB) of proactive memory killer +ex)ProactiveThreshold=30 + +Format: ProactiveLeave= +Comment: specify threshold leave(MB) of proactive memory killer +ex)ProactiveLeave=50 + +Format: EventLevel= +Comment: specify the level of vmpressure among (low, medium, critical) +ex)EventLevel="low" + +Format: SWAPPINESS= +Comment: specify swappiness of the root cgroup +ex)SWAPPINESS=6 + +Format: FOREGROUND_SWAPPINESS= +Comment: specify swappiness of the High cgroup +ex)FOREGROUND_SWAPPINESS=6 + +Format: BACKGROUND_SWAPPINESS= +Comment: specify swappiness of the Medium cgroup +ex)BACKGROUND_SWAPPINESS=6 + +Format: LOW_SWAPPINESS= +Comment: specify swappiness of the Lowest cgroup +ex)LOW_SWAPPINESS=6 + +Format: NumFragSize= +Comment: specify external fragmentation size of "Normal" zone. + the fragmentation_size is the minimum count of order-2 pages in the kernel zone. + if #32K_PAGE + (#64K_PAGE * 2) + (#128K_PAGE * 4) + (#256K_PAGE * 8) < NumFragSize, + then compact memory in the kernel zone. +ex)NumFragSize=300 + +1.4 POPUP +========= +Format: oom_popup= +Comment: specify whether a popup is needed or not when the process is killed by LMK or + proactive killer +ex)oom_popup=no + +1.5 BackgroundReclaim +===================== +Format: AfterScreenDim= +Comment: specify whether background memory reclaim is needed when LCD_OFF signal is caught. + This will cause force reclaim or memory limit on Medium cgroup. +ex)AfterScreenDim=yes + +1.6 Logging +=========== +Format: Enable=<1 or 0> +Comment: specify whether logging is needed or not. + if "Enable" value is 1, then resourced makes a memps log during LMK. +ex)Enable=1 + +Format: LogPath= +Comment: specify logging path +ex)LogPath=/var/log + +Format: MaxNumLogfile= +Comment: specify maximum number of log files +ex)MaxNumLogfile=50 + +Format: PrefixMemps= +Comment: specify prefix of memps log file +ex)PrefixMemps=memps + +Format: PrefixMempsMemLimit= +Comment: specify prefix of memps log file for apps managed by independent cgroup +ex)PrefixMemps=memps_per_app + +1.7 MemLimit +============ +Format: MemLimitTrigger= +Comment: specify type (oom, threshold, others) of trigger for apps managed by independent cgroup + oom: regiter event using oom_control and kill process in kernel + threshold: regiter event using usage_in_bytes and kill process in resourced + others: don't register any event for memory limit +ex)MemLimitTrigger=oom + +Format: MemLimit= +Comment: specify meory limit(MB) for app +ex)MemLimitService=128 (service type app) + MemLimitWidget=128 (widget type app) + MemLimitGUIApp=128 (guiapp type app) + MemLimitBgApp=100 (background state app) + +1.8 CPU +======= +Format: PREDEFINE= +Comment: specify type and its app name. + it makes effect of cpu cgroup, cpu priority, and iopriority +ex)LAZY_PREDEFINE=app1 + PREDEFINE=app2 + BOOTING_PREDEFINE=app3 + WRT_PREDEFINE=app4 + +Format: BACKGROUND_CPU_SHARE= +Comment: specify ratio(%) of background cpu share(= Medium cgroup/root cgroup * 100) +ex)BACKGROUND_CPU_SHARE=50 + +Format: QUOTA_CPU_SHARE= +Comment: specify ratio(%) of quota cpu share(= Lowest cgroup/root cgroup * 100) +ex)QUOTA_CPU_SHARE=25 + +Format: QUOTA_MAX_BANDWIDTH= +Comment: specify ratio(%s) of quota cpu bandwidth + (cpu.cfs_quota_us = cpu.cfs_period_us * ratio/100) +ex)QUOTA_MAX_BANDWIDTH=100 + +1.9 CPU-SCHED +============= +Format: foreground=,- +Comment: specify cpu affinity of each core +ex)foreground=1,2,3-5 + +2. optimizer.conf +================= + +2.1 SWAP +======== +Format: Enable=<1 or 0> +Comment: specify whether swap is needed or not. + Enable=yes or 1 or true / Disalbe=no or 0 or false. + to prevent thrashing, do not set "ReclaimAtBootThreshold" too low. +ex)Enable=1 + +Format: Type= +Comment: specify swap type among (zram, file, zswap). + multiple swap devices are specified with '+'. + for example, both zram and file are enable by zram+file (default is zram). +ex)Type=zram + +Format: ReclaimAtBoot= +Comment: specify whether reclaim is needed at boot time +ex)ReclaimAtBoot=yes + +Format: TimerReclaimAtBoot=