Merge "Change get_sched_policy to check "schedtune" and "cpuset"."

This commit is contained in:
Erik Staats 2017-04-26 16:40:43 +00:00 committed by Gerrit Code Review
commit e74ecbfddd

View file

@ -263,26 +263,26 @@ int get_sched_policy(int tid, SchedPolicy *policy)
char grpBuf[32]; char grpBuf[32];
if (cpusets_enabled()) { grpBuf[0] = '\0';
if (schedboost_enabled()) {
if (getCGroupSubsys(tid, "schedtune", grpBuf, sizeof(grpBuf)) < 0) return -1;
}
if ((grpBuf[0] == '\0') && cpusets_enabled()) {
if (getCGroupSubsys(tid, "cpuset", grpBuf, sizeof(grpBuf)) < 0) return -1; if (getCGroupSubsys(tid, "cpuset", grpBuf, sizeof(grpBuf)) < 0) return -1;
if (grpBuf[0] == '\0') { }
*policy = SP_FOREGROUND; if (grpBuf[0] == '\0') {
} else if (!strcmp(grpBuf, "foreground")) {
*policy = SP_FOREGROUND;
} else if (!strcmp(grpBuf, "system-background")) {
*policy = SP_SYSTEM;
} else if (!strcmp(grpBuf, "background")) {
*policy = SP_BACKGROUND;
} else if (!strcmp(grpBuf, "top-app")) {
*policy = SP_TOP_APP;
} else {
errno = ERANGE;
return -1;
}
} else {
// In b/34193533, we removed bg_non_interactive cgroup, so now
// all threads are in FOREGROUND cgroup
*policy = SP_FOREGROUND; *policy = SP_FOREGROUND;
} else if (!strcmp(grpBuf, "foreground")) {
*policy = SP_FOREGROUND;
} else if (!strcmp(grpBuf, "system-background")) {
*policy = SP_SYSTEM;
} else if (!strcmp(grpBuf, "background")) {
*policy = SP_BACKGROUND;
} else if (!strcmp(grpBuf, "top-app")) {
*policy = SP_TOP_APP;
} else {
errno = ERANGE;
return -1;
} }
return 0; return 0;
} }