Merge "Remove the prctl PR_SET_TIMERSLACK_PID call."
am: b3654fa086
Change-Id: I5f833a1497fcbb8b7c3f1efcd707b6186a6409e6
This commit is contained in:
commit
fb7e8a0088
1 changed files with 2 additions and 10 deletions
|
|
@ -45,9 +45,6 @@ static inline SchedPolicy _policy(SchedPolicy p)
|
||||||
|
|
||||||
#define POLICY_DEBUG 0
|
#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
|
// timer slack value in nS enforced when the thread moves to background
|
||||||
#define TIMER_SLACK_BG 40000000
|
#define TIMER_SLACK_BG 40000000
|
||||||
#define TIMER_SLACK_FG 50000
|
#define TIMER_SLACK_FG 50000
|
||||||
|
|
@ -324,9 +321,9 @@ int set_cpuset_policy(int tid, SchedPolicy policy)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_timerslack_ns(int tid, unsigned long long slack) {
|
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];
|
char buf[64];
|
||||||
|
|
||||||
/* v4.6+ kernels support the /proc/<tid>/timerslack_ns interface. */
|
|
||||||
snprintf(buf, sizeof(buf), "/proc/%d/timerslack_ns", tid);
|
snprintf(buf, sizeof(buf), "/proc/%d/timerslack_ns", tid);
|
||||||
int fd = open(buf, O_WRONLY | O_CLOEXEC);
|
int fd = open(buf, O_WRONLY | O_CLOEXEC);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
|
|
@ -337,11 +334,6 @@ static void set_timerslack_ns(int tid, unsigned long long slack) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
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)
|
int set_sched_policy(int tid, SchedPolicy policy)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue