From ab8d6ab62dfd72e8f5112afdd6e6e3dd6eca19e2 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Tue, 19 Feb 2019 14:09:00 -0800 Subject: [PATCH] libprocessgroup: Fix memcg path for apps The expected memcg path for apps is /dev/memcg/apps/uid_/pid_. Right now we are missing the "apps" component. Fix it. Bug: 124776663 Test: Boot on a Go device and does not see error from lmkd anymore. Change-Id: I0e4c1d8520463fabb171ff4e61479034b6446548 --- libprocessgroup/processgroup.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp index e9dec1261..8505e6146 100644 --- a/libprocessgroup/processgroup.cpp +++ b/libprocessgroup/processgroup.cpp @@ -200,7 +200,7 @@ void removeAllProcessGroups() { cgroups.push_back(path); } if (CgroupGetControllerPath("memory", &path)) { - cgroups.push_back(path); + cgroups.push_back(path + "/apps"); } for (std::string cgroup_root_path : cgroups) { @@ -317,6 +317,7 @@ static int KillProcessGroup(uid_t uid, int initialPid, int signal, int retries) CgroupGetControllerPath("cpuacct", &cpuacct_path); CgroupGetControllerPath("memory", &memory_path); + memory_path += "/apps"; const char* cgroup = (!access(ConvertUidPidToPath(cpuacct_path.c_str(), uid, initialPid).c_str(), F_OK)) @@ -380,6 +381,7 @@ int createProcessGroup(uid_t uid, int initialPid, bool memControl) { std::string cgroup; if (isMemoryCgroupSupported() && (memControl || UsePerAppMemcg())) { CgroupGetControllerPath("memory", &cgroup); + cgroup += "/apps"; } else { CgroupGetControllerPath("cpuacct", &cgroup); }