Merge "Remove the prctl PR_SET_TIMERSLACK_PID call." am: b3654fa086 am: fb7e8a0088
am: a9638e7ff6
Change-Id: I170c97da6dd147d37bb8750bc4c750bf676d611d
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c
index 26f908f..0a8346b 100644
--- a/libcutils/sched_policy.c
+++ b/libcutils/sched_policy.c
@@ -45,9 +45,6 @@
#define POLICY_DEBUG 0
-// This prctl is only available in Android kernels.
-#define PR_SET_TIMERSLACK_PID 41
-
// timer slack value in nS enforced when the thread moves to background
#define TIMER_SLACK_BG 40000000
#define TIMER_SLACK_FG 50000
@@ -330,9 +327,9 @@
}
static void set_timerslack_ns(int tid, unsigned long long slack) {
+ // v4.6+ kernels support the /proc/<tid>/timerslack_ns interface.
+ // TODO: once we've backported this, log if the open(2) fails.
char buf[64];
-
- /* v4.6+ kernels support the /proc/<tid>/timerslack_ns interface. */
snprintf(buf, sizeof(buf), "/proc/%d/timerslack_ns", tid);
int fd = open(buf, O_WRONLY | O_CLOEXEC);
if (fd != -1) {
@@ -343,11 +340,6 @@
close(fd);
return;
}
-
- /* If the above fails, try the old common.git PR_SET_TIMERSLACK_PID. */
- if (prctl(PR_SET_TIMERSLACK_PID, slack, tid) == -1) {
- SLOGE("set_timerslack_ns prctl failed: %s\n", strerror(errno));
- }
}
int set_sched_policy(int tid, SchedPolicy policy)