From d21360b5a8f2a44e50a5c00efba6ff0abf9e1984 Mon Sep 17 00:00:00 2001 From: bengris32 Date: Mon, 22 Jan 2024 04:28:14 +0300 Subject: [PATCH] LG8n: Ship MediaTek cgroup/task_profiles configuration * MediaTek ship their own modified task_profiles and use the V30 cgroups configuration. Change-Id: I15245ea87b00925597db65f1564e808a094c937a Signed-off-by: bengris32 Signed-off-by: Shirayuki39 --- configs/task_profiles.json | 230 +++++++++++++++++++++++++++++++++++++ device.mk | 5 + 2 files changed, 235 insertions(+) create mode 100644 configs/task_profiles.json diff --git a/configs/task_profiles.json b/configs/task_profiles.json new file mode 100644 index 0000000..2eb3d96 --- /dev/null +++ b/configs/task_profiles.json @@ -0,0 +1,230 @@ +{ + "Attributes": [ + { + "Name": "MemLimit", + "Controller": "memory", + "File": "memory.limit_in_bytes" + }, + { + "Name": "MemSoftLimit", + "Controller": "memory", + "File": "memory.soft_limit_in_bytes" + }, + { + "Name": "MemSwappiness", + "Controller": "memory", + "File": "memory.swappiness" + } + ], + + "Profiles": [ + { + "Name": "LowIoPriority", + "Actions": [ + { + "Name": "JoinCgroup", + "Params": + { + "Controller": "blkio", + "Path": "background" + } + } + ] + }, + { + "Name": "NormalIoPriority", + "Actions": [ + { + "Name": "JoinCgroup", + "Params": + { + "Controller": "blkio", + "Path": "" + } + } + ] + }, + { + "Name": "HighIoPriority", + "Actions": [ + { + "Name": "JoinCgroup", + "Params": + { + "Controller": "blkio", + "Path": "" + } + } + ] + }, + { + "Name": "MaxIoPriority", + "Actions": [ + { + "Name": "JoinCgroup", + "Params": + { + "Controller": "blkio", + "Path": "" + } + } + ] + }, + + { + "Name": "TimerSlackHigh", + "Actions": [ + { + "Name": "SetTimerSlack", + "Params": + { + "Slack": "50000" + } + } + ] + }, + { + "Name": "TimerSlackNormal", + "Actions": [ + { + "Name": "SetTimerSlack", + "Params": + { + "Slack": "50000" + } + } + ] + }, + + { + "Name": "PerfBoost", + "Actions": [ + { + "Name": "SetClamps", + "Params": + { + "Boost": "50%", + "Clamp": "0" + } + } + ] + }, + { + "Name": "PerfClamp", + "Actions": [ + { + "Name": "SetClamps", + "Params": + { + "Boost": "0", + "Clamp": "30%" + } + } + ] + }, + + { + "Name": "LowMemoryUsage", + "Actions": [ + { + "Name": "SetAttribute", + "Params": + { + "Name": "MemSoftLimit", + "Value": "16MB" + } + }, + { + "Name": "SetAttribute", + "Params": + { + "Name": "MemSwappiness", + "Value": "150" + + } + } + ] + }, + { + "Name": "HighMemoryUsage", + "Actions": [ + { + "Name": "SetAttribute", + "Params": + { + "Name": "MemSoftLimit", + "Value": "512MB" + } + }, + { + "Name": "SetAttribute", + "Params": + { + "Name": "MemSwappiness", + "Value": "100" + } + } + ] + }, + { + "Name": "SystemMemoryProcess", + "Actions": [ + { + "Name": "JoinCgroup", + "Params": + { + "Controller": "memory", + "Path": "system" + } + } + ] + } + ], + + "AggregateProfiles": [ + { + "Name": "SCHED_SP_DEFAULT", + "Profiles": [ "TimerSlackNormal" ] + }, + { + "Name": "SCHED_SP_BACKGROUND", + "Profiles": [ "HighEnergySaving", "LowIoPriority", "TimerSlackHigh" ] + }, + { + "Name": "SCHED_SP_FOREGROUND", + "Profiles": [ "HighPerformance", "HighIoPriority", "TimerSlackNormal" ] + }, + { + "Name": "SCHED_SP_TOP_APP", + "Profiles": [ "MaxPerformance", "MaxIoPriority", "TimerSlackNormal" ] + }, + { + "Name": "SCHED_SP_RT_APP", + "Profiles": [ "RealtimePerformance", "MaxIoPriority", "TimerSlackNormal" ] + }, + { + "Name": "CPUSET_SP_DEFAULT", + "Profiles": [ "TimerSlackNormal" ] + }, + { + "Name": "CPUSET_SP_BACKGROUND", + "Profiles": [ "HighEnergySaving", "ProcessCapacityLow", "LowIoPriority", "TimerSlackHigh" ] + }, + { + "Name": "CPUSET_SP_FOREGROUND", + "Profiles": [ "HighPerformance", "ProcessCapacityHigh", "HighIoPriority", "TimerSlackNormal" ] + }, + { + "Name": "CPUSET_SP_TOP_APP", + "Profiles": [ "MaxPerformance", "ProcessCapacityMax", "MaxIoPriority", "TimerSlackNormal" ] + }, + { + "Name": "CPUSET_SP_SYSTEM", + "Profiles": [ "ServiceCapacityLow", "TimerSlackNormal" ] + }, + { + "Name": "CPUSET_SP_RESTRICTED", + "Profiles": [ "ServiceCapacityRestricted", "TimerSlackNormal" ] + } + ] +} diff --git a/device.mk b/device.mk index 245ddc0..81df27c 100644 --- a/device.mk +++ b/device.mk @@ -96,6 +96,11 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ libdng_sdk.vendor +# Cgroup +PRODUCT_COPY_FILES += \ + system/core/libprocessgroup/profiles/cgroups_30.json:$(TARGET_COPY_OUT_VENDOR)/etc/cgroups.json \ + $(LOCAL_PATH)/configs/task_profiles.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json + # Dalvik configs $(call inherit-product, frameworks/native/build/phone-xhdpi-6144-dalvik-heap.mk)