From 1b53c2496dca274bd3f8173780a7d6562b5cc016 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Tue, 18 Jun 2019 13:33:23 -0700 Subject: [PATCH 1/2] libprocessgroup: Replace stune with utilclamp profiles Replace schedtune out-of-tree controller's usage in the performance profiles with utilclamp controller. Stop mounting schedtune controller. Bug: 170507876 Test: cpuctl groups worked Signed-off-by: Suren Baghdasaryan Change-Id: Ib7fa6c902581398587c75414845c2ff6c8bdb005 --- libprocessgroup/profiles/cgroups.json | 7 ---- libprocessgroup/profiles/task_profiles.json | 44 ++++++++++++--------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/libprocessgroup/profiles/cgroups.json b/libprocessgroup/profiles/cgroups.json index 451848711..5b7a28a91 100644 --- a/libprocessgroup/profiles/cgroups.json +++ b/libprocessgroup/profiles/cgroups.json @@ -32,13 +32,6 @@ "Mode": "0700", "UID": "root", "GID": "system" - }, - { - "Controller": "schedtune", - "Path": "/dev/stune", - "Mode": "0755", - "UID": "system", - "GID": "system" } ], "Cgroups2": { diff --git a/libprocessgroup/profiles/task_profiles.json b/libprocessgroup/profiles/task_profiles.json index c4dbf8e55..ea0064f55 100644 --- a/libprocessgroup/profiles/task_profiles.json +++ b/libprocessgroup/profiles/task_profiles.json @@ -30,16 +30,6 @@ "Controller": "memory", "File": "memory.swappiness" }, - { - "Name": "STuneBoost", - "Controller": "schedtune", - "File": "schedtune.boost" - }, - { - "Name": "STunePreferIdle", - "Controller": "schedtune", - "File": "schedtune.prefer_idle" - }, { "Name": "UClampMin", "Controller": "cpu", @@ -50,6 +40,11 @@ "Controller": "cpu", "File": "cpu.uclamp.max" }, + { + "Name": "UClampLatencySensitive", + "Controller": "cpu", + "File": "cpu.uclamp.latency_sensitive" + }, { "Name": "FreezerState", "Controller": "freezer", @@ -65,7 +60,7 @@ "Name": "JoinCgroup", "Params": { - "Controller": "schedtune", + "Controller": "cpu", "Path": "background" } } @@ -104,7 +99,7 @@ "Name": "JoinCgroup", "Params": { - "Controller": "schedtune", + "Controller": "cpu", "Path": "" } } @@ -117,7 +112,7 @@ "Name": "JoinCgroup", "Params": { - "Controller": "schedtune", + "Controller": "cpu", "Path": "foreground" } } @@ -130,7 +125,7 @@ "Name": "JoinCgroup", "Params": { - "Controller": "schedtune", + "Controller": "cpu", "Path": "top-app" } } @@ -143,7 +138,7 @@ "Name": "JoinCgroup", "Params": { - "Controller": "schedtune", + "Controller": "cpu", "Path": "rt" } } @@ -156,12 +151,25 @@ "Name": "JoinCgroup", "Params": { - "Controller": "schedtune", + "Controller": "cpu", "Path": "camera-daemon" } } ] }, + { + "Name": "NNApiHALPerformance", + "Actions": [ + { + "Name": "JoinCgroup", + "Params": + { + "Controller": "cpu", + "Path": "nnapi-hal" + } + } + ] + }, { "Name": "CpuPolicySpread", @@ -170,7 +178,7 @@ "Name": "SetAttribute", "Params": { - "Name": "STunePreferIdle", + "Name": "UClampLatencySensitive", "Value": "1" } } @@ -183,7 +191,7 @@ "Name": "SetAttribute", "Params": { - "Name": "STunePreferIdle", + "Name": "UClampLatencySensitive", "Value": "0" } } From c6baa19d6c53f94b48ada031b9ce6244e7ff2fbc Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Tue, 13 Oct 2020 10:41:00 -0700 Subject: [PATCH 2/2] init: Add cpu controller hierarchy to use utilclamp controller For devices using utilclamp create cpu controller hierarchy. Do not remove schedtune hierarchy yet because init.rc is generic and should work with devices which still use schedtune. Bug: 170507876 Test: cpuctl groups worked Signed-off-by: Suren Baghdasaryan Change-Id: I8494b0b64336e0c882847d555c262814bef2ffa1 --- rootdir/init.rc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/rootdir/init.rc b/rootdir/init.rc index 900edb4cc..746fc61dc 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -148,6 +148,27 @@ on init chmod 0664 /dev/stune/top-app/tasks chmod 0664 /dev/stune/rt/tasks + # cpuctl hierarchy for devices using utilclamp + mkdir /dev/cpuctl/foreground + mkdir /dev/cpuctl/background + mkdir /dev/cpuctl/top-app + mkdir /dev/cpuctl/rt + chown system system /dev/cpuctl + chown system system /dev/cpuctl/foreground + chown system system /dev/cpuctl/background + chown system system /dev/cpuctl/top-app + chown system system /dev/cpuctl/rt + chown system system /dev/cpuctl/tasks + chown system system /dev/cpuctl/foreground/tasks + chown system system /dev/cpuctl/background/tasks + chown system system /dev/cpuctl/top-app/tasks + chown system system /dev/cpuctl/rt/tasks + chmod 0664 /dev/cpuctl/tasks + chmod 0664 /dev/cpuctl/foreground/tasks + chmod 0664 /dev/cpuctl/background/tasks + chmod 0664 /dev/cpuctl/top-app/tasks + chmod 0664 /dev/cpuctl/rt/tasks + # Create an stune group for NNAPI HAL processes mkdir /dev/stune/nnapi-hal chown system system /dev/stune/nnapi-hal @@ -156,6 +177,14 @@ on init write /dev/stune/nnapi-hal/schedtune.boost 1 write /dev/stune/nnapi-hal/schedtune.prefer_idle 1 + # cpuctl hierarchy for devices using utilclamp + mkdir /dev/cpuctl/nnapi-hal + chown system system /dev/cpuctl/nnapi-hal + chown system system /dev/cpuctl/nnapi-hal/tasks + chmod 0664 /dev/cpuctl/nnapi-hal/tasks + write /dev/cpuctl/nnapi-hal/cpu.uclamp.min 1 + write /dev/cpuctl/nnapi-hal/cpu.uclamp.latency_sensitive 1 + # Create blkio group and apply initial settings. # This feature needs kernel to support it, and the # device's init.rc must actually set the correct values.