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/cgroups.proto b/libprocessgroup/profiles/cgroups.proto index f4070c550..13adcae07 100644 --- a/libprocessgroup/profiles/cgroups.proto +++ b/libprocessgroup/profiles/cgroups.proto @@ -24,19 +24,24 @@ message Cgroups { Cgroups2 cgroups2 = 2 [json_name = "Cgroups2"]; } -// Next: 6 +// Next: 7 message Cgroup { string controller = 1 [json_name = "Controller"]; string path = 2 [json_name = "Path"]; string mode = 3 [json_name = "Mode"]; string uid = 4 [json_name = "UID"]; string gid = 5 [json_name = "GID"]; +// Booleans default to false when not specified. File reconstruction fails +// when a boolean is specified as false, so leave unspecified in that case +// https://developers.google.com/protocol-buffers/docs/proto3#default + bool needs_activation = 6 [json_name = "NeedsActivation"]; } -// Next: 5 +// Next: 6 message Cgroups2 { string path = 1 [json_name = "Path"]; string mode = 2 [json_name = "Mode"]; string uid = 3 [json_name = "UID"]; string gid = 4 [json_name = "GID"]; + repeated Cgroup controllers = 5 [json_name = "Controllers"]; } diff --git a/libprocessgroup/profiles/task_profiles.json b/libprocessgroup/profiles/task_profiles.json index a515e58c6..c4dbf8e55 100644 --- a/libprocessgroup/profiles/task_profiles.json +++ b/libprocessgroup/profiles/task_profiles.json @@ -49,6 +49,11 @@ "Name": "UClampMax", "Controller": "cpu", "File": "cpu.uclamp.max" + }, + { + "Name": "FreezerState", + "Controller": "freezer", + "File": "cgroup.freeze" } ], @@ -74,7 +79,7 @@ "Params": { "Controller": "freezer", - "Path": "frozen" + "Path": "" } } ] @@ -87,7 +92,7 @@ "Params": { "Controller": "freezer", - "Path": "" + "Path": "../" } } ] @@ -531,6 +536,32 @@ } } ] + }, + { + "Name": "FreezerDisabled", + "Actions": [ + { + "Name": "SetAttribute", + "Params": + { + "Name": "FreezerState", + "Value": "0" + } + } + ] + }, + { + "Name": "FreezerEnabled", + "Actions": [ + { + "Name": "SetAttribute", + "Params": + { + "Name": "FreezerState", + "Value": "1" + } + } + ] } ], diff --git a/rootdir/init.rc b/rootdir/init.rc index 6ef3bdca6..37f911a34 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 0444 /dev/freezer/frozen/freezer.state - # make the PSI monitor accessible to others chown system system /proc/pressure/memory chmod 0664 /proc/pressure/memory @@ -348,8 +338,6 @@ on init # This is needed by any process that uses socket tagging. chmod 0644 /dev/xt_qtaguid - chown root root /dev/cg2_bpf - chmod 0600 /dev/cg2_bpf mount bpf bpf /sys/fs/bpf nodev noexec nosuid # Create location for fs_mgr to store abbreviated output from filesystem