From d7967c1347cf83b7ff621629aeb69f5fb57d9976 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 3 Aug 2016 15:11:01 -0700 Subject: [PATCH] Remove the prctl PR_SET_TIMERSLACK_PID call. This is broken on all devices other than N9, and has no real path to fixing it because there are so many different values already in use (41, 43, 47, 127), with no way to tell which you should use on any given device. Bug: http://b/30597190 Change-Id: I07eeaaf6f5dc03c5532ffbfbb85ef2ad750206a0 --- libcutils/sched_policy.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c index d7b4b0be1..5c68add29 100644 --- a/libcutils/sched_policy.c +++ b/libcutils/sched_policy.c @@ -45,9 +45,6 @@ static inline SchedPolicy _policy(SchedPolicy p) #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 @@ -293,9 +290,9 @@ int set_cpuset_policy(int tid, SchedPolicy policy) } static void set_timerslack_ns(int tid, unsigned long long slack) { + // v4.6+ kernels support the /proc//timerslack_ns interface. + // TODO: once we've backported this, log if the open(2) fails. char buf[64]; - - /* v4.6+ kernels support the /proc//timerslack_ns interface. */ snprintf(buf, sizeof(buf), "/proc/%d/timerslack_ns", tid); int fd = open(buf, O_WRONLY | O_CLOEXEC); if (fd != -1) { @@ -306,11 +303,6 @@ static void set_timerslack_ns(int tid, unsigned long long slack) { 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)