libcutils: Add support for RT schedtune group
Add an SP_RT_APP group which will be used to provide minimum
capacity guarantees to RT tasks sensitive to frequency drops
such as synthesizer workloads.
Bug: 33085313
Change-Id: I07cca79e52661d1325a1db9ef3b61eb0f8d20989
Signed-off-by: Joel Fernandes <joelaf@google.com>
diff --git a/libcutils/sched_policy.cpp b/libcutils/sched_policy.cpp
index e29a844..7170b48 100644
--- a/libcutils/sched_policy.cpp
+++ b/libcutils/sched_policy.cpp
@@ -70,6 +70,7 @@
static int bg_schedboost_fd = -1;
static int fg_schedboost_fd = -1;
static int ta_schedboost_fd = -1;
+static int rt_schedboost_fd = -1;
/* Add tid to the scheduling group defined by the policy */
static int add_tid_to_cgroup(int tid, int fd)
@@ -173,6 +174,8 @@
fg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
filename = "/dev/stune/background/tasks";
bg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
+ filename = "/dev/stune/rt/tasks";
+ rt_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
}
}
}
@@ -408,6 +411,9 @@
case SP_SYSTEM:
SLOGD("/// tid %d (%s)", tid, thread_name);
break;
+ case SP_RT_APP:
+ SLOGD("RT tid %d (%s)", tid, thread_name);
+ break;
default:
SLOGD("??? tid %d (%s)", tid, thread_name);
break;
@@ -428,6 +434,9 @@
case SP_TOP_APP:
boost_fd = ta_schedboost_fd;
break;
+ case SP_RT_APP:
+ boost_fd = rt_schedboost_fd;
+ break;
default:
boost_fd = -1;
break;
@@ -472,6 +481,7 @@
[SP_AUDIO_APP] = "aa",
[SP_AUDIO_SYS] = "as",
[SP_TOP_APP] = "ta",
+ [SP_RT_APP] = "rt",
};
if ((policy < SP_CNT) && (strings[policy] != NULL))
return strings[policy];