Merge "add cpuset support" into mnc-dev

This commit is contained in:
Tim Murray
2015-06-24 22:59:51 +00:00
committed by Android (Google) Code Review
2 changed files with 26 additions and 3 deletions

View File

@@ -16,6 +16,10 @@ else
LOCAL_CFLAGS += -DPACKED=""
endif
ifneq ($(ENABLE_CPUSETS),)
LOCAL_CFLAGS += -DENABLE_CPUSETS
endif
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
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) {
int scheduler = sched_getscheduler(t_pid);
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;
}
}
@@ -247,15 +248,33 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin
if (isDefault) {
if (t_pri >= ANDROID_PRIORITY_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;
}
}
int err = set_sched_policy(t_pid, sp);
int err;
#ifdef ENABLE_CPUSETS
// set both cpuset and cgroup for general threads
err = set_cpuset_policy(t_pid, sp);
if (err != NO_ERROR) {
signalExceptionForGroupError(env, -err);
break;
}
#endif
err = set_sched_policy(t_pid, sp);
if (err != NO_ERROR) {
signalExceptionForGroupError(env, -err);
break;
}
}
closedir(d);
}