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
Merged-In: I1b811300ade486f88fdbd157255a7f37750cc54d
diff --git a/libprocessgroup/profiles/cgroups.json b/libprocessgroup/profiles/cgroups.json
index 0341902..4518487 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 bc6bc7c..c4dbf8e 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 510d1e9..01ad32d 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -322,16 +322,6 @@
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