From 64811b7b13f6a52f6603132323f23dcc57b45ff1 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Tue, 14 Jan 2020 12:55:57 +0000 Subject: [PATCH] libprocessgroup: ensure schedboost_enabled is true with uclamp In the current state, schedboost_enabled() is true if and only if schedtune is in use. As a result, all tests conditioned by schedboost_enabled() will be skipped on devices using uclamp since it is and extension of the CPU controller. Fix this by making schedboost_enabled() return true if either schedtune or the CPU controller is enabled. Bug: 44953631 Change-Id: Idaadf252c9cf411a176180ab8988d559ca8a1332 Signed-off-by: Quentin Perret --- libprocessgroup/sched_policy.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libprocessgroup/sched_policy.cpp b/libprocessgroup/sched_policy.cpp index 16339d3d0..698e74d40 100644 --- a/libprocessgroup/sched_policy.cpp +++ b/libprocessgroup/sched_policy.cpp @@ -138,8 +138,17 @@ bool cpusets_enabled() { return enabled; } +static bool schedtune_enabled() { + return (CgroupMap::GetInstance().FindController("schedtune").IsUsable()); +} + +static bool cpuctl_enabled() { + return (CgroupMap::GetInstance().FindController("cpu").IsUsable()); +} + bool schedboost_enabled() { - static bool enabled = (CgroupMap::GetInstance().FindController("schedtune").IsUsable()); + static bool enabled = schedtune_enabled() || cpuctl_enabled(); + return enabled; } @@ -162,7 +171,9 @@ int get_sched_policy(int tid, SchedPolicy* policy) { std::string group; if (schedboost_enabled()) { - if (getCGroupSubsys(tid, "schedtune", group) < 0) return -1; + if ((getCGroupSubsys(tid, "schedtune", group) < 0) && + (getCGroupSubsys(tid, "cpu", group) < 0)) + return -1; } if (group.empty() && cpusets_enabled()) { if (getCGroupSubsys(tid, "cpuset", group) < 0) return -1;