Check property before switch mem cgroup

This commit is contained in:
vvb2060 2022-02-24 16:05:24 +08:00 committed by John Wu
parent 666ab1941f
commit c82a46c1ee

View File

@ -308,9 +308,11 @@ static void daemon_entry() {
// Escape from cgroup // Escape from cgroup
int pid = getpid(); int pid = getpid();
switch_cgroup("/acct", pid); switch_cgroup("/acct", pid);
switch_cgroup("/dev/memcg/apps", pid);
switch_cgroup("/dev/cg2_bpf", pid); switch_cgroup("/dev/cg2_bpf", pid);
switch_cgroup("/sys/fs/cgroup", pid); switch_cgroup("/sys/fs/cgroup", pid);
if (getprop("ro.config.per_app_memcg") != "false") {
switch_cgroup("/dev/memcg/apps", pid);
}
// Get self stat // Get self stat
char buf[64]; char buf[64];