From 1c755e22c8fac626aec289bff181191e6e87a237 Mon Sep 17 00:00:00 2001 From: Marco Ballesio Date: Tue, 2 Jun 2020 15:35:30 -0700 Subject: [PATCH] libprocessgroup: switch freezer to cgroup v2 remove cgroup v1 freezer entries from init.rc, add a new cgroup v2 controller and modify plists to properly interact with it. Bug: 154548692 Test: manually verified the the cgroup v1 freezer controller isn't created and a new controller for cgroup v2 is created under the correct sysfs directory. Change-Id: I1b811300ade486f88fdbd157255a7f37750cc54d --- libprocessgroup/profiles/cgroups.json | 24 +++++++++++---------- libprocessgroup/profiles/task_profiles.json | 14 ++++++------ rootdir/init.rc | 10 --------- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/libprocessgroup/profiles/cgroups.json b/libprocessgroup/profiles/cgroups.json index 03419020c..451848711 100644 --- a/libprocessgroup/profiles/cgroups.json +++ b/libprocessgroup/profiles/cgroups.json @@ -39,19 +39,21 @@ "Mode": "0755", "UID": "system", "GID": "system" - }, - { - "Controller": "freezer", - "Path": "/dev/freezer", - "Mode": "0755", - "UID": "system", - "GID": "system" } ], "Cgroups2": { - "Path": "/dev/cg2_bpf", - "Mode": "0600", - "UID": "root", - "GID": "root" + "Path": "/sys/fs/cgroup", + "Mode": "0755", + "UID": "system", + "GID": "system", + "Controllers": [ + { + "Controller": "freezer", + "Path": "freezer", + "Mode": "0755", + "UID": "system", + "GID": "system" + } + ] } } diff --git a/libprocessgroup/profiles/task_profiles.json b/libprocessgroup/profiles/task_profiles.json index bc6bc7c25..c4dbf8e55 100644 --- a/libprocessgroup/profiles/task_profiles.json +++ b/libprocessgroup/profiles/task_profiles.json @@ -53,7 +53,7 @@ { "Name": "FreezerState", "Controller": "freezer", - "File": "frozen/freezer.state" + "File": "cgroup.freeze" } ], @@ -79,7 +79,7 @@ "Params": { "Controller": "freezer", - "Path": "frozen" + "Path": "" } } ] @@ -92,7 +92,7 @@ "Params": { "Controller": "freezer", - "Path": "" + "Path": "../" } } ] @@ -538,27 +538,27 @@ ] }, { - "Name": "FreezerThawed", + "Name": "FreezerDisabled", "Actions": [ { "Name": "SetAttribute", "Params": { "Name": "FreezerState", - "Value": "THAWED" + "Value": "0" } } ] }, { - "Name": "FreezerFrozen", + "Name": "FreezerEnabled", "Actions": [ { "Name": "SetAttribute", "Params": { "Name": "FreezerState", - "Value": "FROZEN" + "Value": "1" } } ] diff --git a/rootdir/init.rc b/rootdir/init.rc index 6fab57250..9079fa4b7 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -324,16 +324,6 @@ on init chmod 0664 /dev/cpuset/restricted/tasks chmod 0664 /dev/cpuset/tasks - # freezer cgroup entries - mkdir /dev/freezer/frozen - write /dev/freezer/frozen/freezer.state FROZEN - chown system system /dev/freezer/cgroup.procs - chown system system /dev/freezer/frozen - chown system system /dev/freezer/frozen/freezer.state - chown system system /dev/freezer/frozen/cgroup.procs - - chmod 0664 /dev/freezer/frozen/freezer.state - # make the PSI monitor accessible to others chown system system /proc/pressure/memory chmod 0664 /proc/pressure/memory