Merge changes from topic "cgroup v2 freezer" am: 8b0b53a913

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1407073

Change-Id: I1a092f58c8ec513cc29cdda6a07c0d7cc10426ee
This commit is contained in:
Marco Ballesio 2020-08-21 18:51:27 +00:00 committed by Automerger Merge Worker
commit ff0a789f8f
4 changed files with 53 additions and 27 deletions

View file

@ -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"
}
]
}
}

View file

@ -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"];
}

View file

@ -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"
}
}
]
}
],

View file

@ -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