From c82a46c1ee7871068869b9a5465d5713dd6f2516 Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Thu, 24 Feb 2022 16:05:24 +0800 Subject: [PATCH] Check property before switch mem cgroup --- native/jni/core/daemon.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/native/jni/core/daemon.cpp b/native/jni/core/daemon.cpp index 617646f48..5aaab0859 100644 --- a/native/jni/core/daemon.cpp +++ b/native/jni/core/daemon.cpp @@ -308,9 +308,11 @@ static void daemon_entry() { // Escape from cgroup int pid = getpid(); switch_cgroup("/acct", pid); - switch_cgroup("/dev/memcg/apps", pid); switch_cgroup("/dev/cg2_bpf", pid); switch_cgroup("/sys/fs/cgroup", pid); + if (getprop("ro.config.per_app_memcg") != "false") { + switch_cgroup("/dev/memcg/apps", pid); + } // Get self stat char buf[64];