Loading libprocessgroup/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ cc_library { header_libs: [ "libcutils_headers", "libprocessgroup_headers", "libprocessgroup_util", ], export_include_dirs: ["include"], export_header_lib_headers: [ Loading libprocessgroup/cgroup_map.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <android-base/strings.h> #include <cgroup_map.h> #include <processgroup/processgroup.h> #include <processgroup/util.h> using android::base::StartsWith; using android::base::StringPrintf; Loading Loading @@ -216,7 +217,13 @@ int CgroupMap::ActivateControllers(const std::string& path) const { for (uint32_t i = 0; i < controller_count; ++i) { const ACgroupController* controller = ACgroupFile_getController(i); const uint32_t flags = ACgroupController_getFlags(controller); if (flags & CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION) { uint32_t max_activation_depth = UINT32_MAX; if (__builtin_available(android 36, *)) { max_activation_depth = ACgroupController_getMaxActivationDepth(controller); } const int depth = util::GetCgroupDepth(ACgroupController_getPath(controller), path); if (flags & CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION && depth < max_activation_depth) { std::string str("+"); str.append(ACgroupController_getName(controller)); if (!WriteStringToFile(str, path + "/cgroup.subtree_control")) { Loading libprocessgroup/cgrouprc/cgroup_controller.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,11 @@ uint32_t ACgroupController_getFlags(const ACgroupController* controller) { return controller->flags(); } uint32_t ACgroupController_getMaxActivationDepth(const ACgroupController* controller) { CHECK(controller != nullptr); return controller->max_activation_depth(); } const char* ACgroupController_getName(const ACgroupController* controller) { CHECK(controller != nullptr); return controller->name(); Loading libprocessgroup/cgrouprc/include/android/cgrouprc.h +8 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,14 @@ __attribute__((warn_unused_result)) uint32_t ACgroupController_getVersion(const __attribute__((warn_unused_result, weak)) uint32_t ACgroupController_getFlags( const ACgroupController*) __INTRODUCED_IN(30); /** * Returns the maximum activation depth of the given controller. * Only applicable to cgroup v2 controllers. * Returns UINT32_MAX if no maximum activation depth is set. */ __attribute__((warn_unused_result, weak)) uint32_t ACgroupController_getMaxActivationDepth( const ACgroupController* controller) __INTRODUCED_IN(36); /** * Returns the name of the given controller. * If the given controller is null, return nullptr. Loading libprocessgroup/cgrouprc/libcgrouprc.map.txt +7 −0 Original line number Diff line number Diff line Loading @@ -16,3 +16,10 @@ LIBCGROUPRC_30 { # introduced=30 local: *; }; LIBCGROUPRC_36 { # introduced=36 global: ACgroupController_getMaxActivationDepth; # llndk=202504 systemapi local: *; }; Loading
libprocessgroup/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ cc_library { header_libs: [ "libcutils_headers", "libprocessgroup_headers", "libprocessgroup_util", ], export_include_dirs: ["include"], export_header_lib_headers: [ Loading
libprocessgroup/cgroup_map.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <android-base/strings.h> #include <cgroup_map.h> #include <processgroup/processgroup.h> #include <processgroup/util.h> using android::base::StartsWith; using android::base::StringPrintf; Loading Loading @@ -216,7 +217,13 @@ int CgroupMap::ActivateControllers(const std::string& path) const { for (uint32_t i = 0; i < controller_count; ++i) { const ACgroupController* controller = ACgroupFile_getController(i); const uint32_t flags = ACgroupController_getFlags(controller); if (flags & CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION) { uint32_t max_activation_depth = UINT32_MAX; if (__builtin_available(android 36, *)) { max_activation_depth = ACgroupController_getMaxActivationDepth(controller); } const int depth = util::GetCgroupDepth(ACgroupController_getPath(controller), path); if (flags & CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION && depth < max_activation_depth) { std::string str("+"); str.append(ACgroupController_getName(controller)); if (!WriteStringToFile(str, path + "/cgroup.subtree_control")) { Loading
libprocessgroup/cgrouprc/cgroup_controller.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,11 @@ uint32_t ACgroupController_getFlags(const ACgroupController* controller) { return controller->flags(); } uint32_t ACgroupController_getMaxActivationDepth(const ACgroupController* controller) { CHECK(controller != nullptr); return controller->max_activation_depth(); } const char* ACgroupController_getName(const ACgroupController* controller) { CHECK(controller != nullptr); return controller->name(); Loading
libprocessgroup/cgrouprc/include/android/cgrouprc.h +8 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,14 @@ __attribute__((warn_unused_result)) uint32_t ACgroupController_getVersion(const __attribute__((warn_unused_result, weak)) uint32_t ACgroupController_getFlags( const ACgroupController*) __INTRODUCED_IN(30); /** * Returns the maximum activation depth of the given controller. * Only applicable to cgroup v2 controllers. * Returns UINT32_MAX if no maximum activation depth is set. */ __attribute__((warn_unused_result, weak)) uint32_t ACgroupController_getMaxActivationDepth( const ACgroupController* controller) __INTRODUCED_IN(36); /** * Returns the name of the given controller. * If the given controller is null, return nullptr. Loading
libprocessgroup/cgrouprc/libcgrouprc.map.txt +7 −0 Original line number Diff line number Diff line Loading @@ -16,3 +16,10 @@ LIBCGROUPRC_30 { # introduced=30 local: *; }; LIBCGROUPRC_36 { # introduced=36 global: ACgroupController_getMaxActivationDepth; # llndk=202504 systemapi local: *; };