am 948c6ecc: Merge "add cpuset support" into mnc-dev

* commit '948c6ecc5a460ce78dc1d012ccb3efc844699985':
  add cpuset support
This commit is contained in:
Tim Murray
2015-06-24 23:08:43 +00:00
committed by Android Git Automerger
2 changed files with 26 additions and 3 deletions

View File

@@ -16,6 +16,10 @@ else
LOCAL_CFLAGS += -DPACKED="" LOCAL_CFLAGS += -DPACKED=""
endif endif
ifneq ($(ENABLE_CPUSETS),)
LOCAL_CFLAGS += -DENABLE_CPUSETS
endif
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
LOCAL_CFLAGS += -DU_USING_ICU_NAMESPACE=0 LOCAL_CFLAGS += -DU_USING_ICU_NAMESPACE=0

View File

@@ -239,7 +239,8 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin
if (t_pri <= ANDROID_PRIORITY_AUDIO) { if (t_pri <= ANDROID_PRIORITY_AUDIO) {
int scheduler = sched_getscheduler(t_pid); int scheduler = sched_getscheduler(t_pid);
if ((scheduler == SCHED_FIFO) || (scheduler == SCHED_RR)) { if ((scheduler == SCHED_FIFO) || (scheduler == SCHED_RR)) {
// This task wants to stay in it's current audio group so it can keep it's budget // This task wants to stay in its current audio group so it can keep its budget
// don't update its cpuset or cgroup
continue; continue;
} }
} }
@@ -247,15 +248,33 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin
if (isDefault) { if (isDefault) {
if (t_pri >= ANDROID_PRIORITY_BACKGROUND) { if (t_pri >= ANDROID_PRIORITY_BACKGROUND) {
// This task wants to stay at background // This task wants to stay at background
// update its cpuset so it doesn't only run on bg core(s)
#ifdef ENABLE_CPUSETS
int err = set_cpuset_policy(t_pid, sp);
if (err != NO_ERROR) {
signalExceptionForGroupError(env, -err);
break;
}
#endif
continue; continue;
} }
} }
int err;
int err = set_sched_policy(t_pid, sp); #ifdef ENABLE_CPUSETS
// set both cpuset and cgroup for general threads
err = set_cpuset_policy(t_pid, sp);
if (err != NO_ERROR) { if (err != NO_ERROR) {
signalExceptionForGroupError(env, -err); signalExceptionForGroupError(env, -err);
break; break;
} }
#endif
err = set_sched_policy(t_pid, sp);
if (err != NO_ERROR) {
signalExceptionForGroupError(env, -err);
break;
}
} }
closedir(d); closedir(d);
} }