From b0947e008a16e33331b551206237a5a90c1ae91a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 7 Feb 2023 14:46:15 -0800 Subject: [PATCH] libprocessgroup: Proceed if activation of an optional controller fails Not all Android kernels support all the cgroup controllers mentioned in task_profiles.json and/or cgroups.json. Support such kernels by ignoring certain cgroup activation failures. Bug: 213617178 Change-Id: I90c0bd959f8a6484c4f2fbc895845e073527271e Signed-off-by: Bart Van Assche --- libprocessgroup/cgroup_map.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libprocessgroup/cgroup_map.cpp b/libprocessgroup/cgroup_map.cpp index ac369d2bd..ce7f10b00 100644 --- a/libprocessgroup/cgroup_map.cpp +++ b/libprocessgroup/cgroup_map.cpp @@ -234,7 +234,12 @@ int CgroupMap::ActivateControllers(const std::string& path) const { std::string str("+"); str.append(ACgroupController_getName(controller)); if (!WriteStringToFile(str, path + "/cgroup.subtree_control")) { - return -errno; + if (flags & CGROUPRC_CONTROLLER_FLAG_OPTIONAL) { + PLOG(WARNING) << "Activation of cgroup controller " << str + << " failed in path " << path; + } else { + return -errno; + } } } }