Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d95aa50b authored by Isaac Chen's avatar Isaac Chen Committed by Gerrit Code Review
Browse files

Merge "Turned ENABLE_CPUSETS into runtime decision."

parents 372b6b2c d34fac54
Loading
Loading
Loading
Loading
+28 −30
Original line number Original line Diff line number Diff line
@@ -252,25 +252,26 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin
            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)
                // update its cpuset so it doesn't only run on bg core(s)
#ifdef ENABLE_CPUSETS
                if (cpusets_enabled()) {
                    int err = set_cpuset_policy(t_pid, sp);
                    int err = set_cpuset_policy(t_pid, sp);
                    if (err != NO_ERROR) {
                    if (err != NO_ERROR) {
                        signalExceptionForGroupError(env, -err, t_pid);
                        signalExceptionForGroupError(env, -err, t_pid);
                        break;
                        break;
                    }
                    }
#endif
                }
                continue;
                continue;
            }
            }
        }
        }
        int err;
        int err;
#ifdef ENABLE_CPUSETS

        if (cpusets_enabled()) {
            // set both cpuset and cgroup for general threads
            // set both cpuset and cgroup for general threads
            err = set_cpuset_policy(t_pid, sp);
            err = set_cpuset_policy(t_pid, sp);
            if (err != NO_ERROR) {
            if (err != NO_ERROR) {
                signalExceptionForGroupError(env, -err, t_pid);
                signalExceptionForGroupError(env, -err, t_pid);
                break;
                break;
            }
            }
#endif
        }


        err = set_sched_policy(t_pid, sp);
        err = set_sched_policy(t_pid, sp);
        if (err != NO_ERROR) {
        if (err != NO_ERROR) {
@@ -291,7 +292,6 @@ jint android_os_Process_getProcessGroup(JNIEnv* env, jobject clazz, jint pid)
    return (int) sp;
    return (int) sp;
}
}


#ifdef ENABLE_CPUSETS
/** Sample CPUset list format:
/** Sample CPUset list format:
 *  0-3,4,6-8
 *  0-3,4,6-8
 */
 */
@@ -367,7 +367,6 @@ static void get_cpuset_cores_for_policy(SchedPolicy policy, cpu_set_t *cpu_set)
    }
    }
    return;
    return;
}
}
#endif




/**
/**
@@ -376,7 +375,7 @@ static void get_cpuset_cores_for_policy(SchedPolicy policy, cpu_set_t *cpu_set)
 * them in the passed in cpu_set_t
 * them in the passed in cpu_set_t
 */
 */
void get_exclusive_cpuset_cores(SchedPolicy policy, cpu_set_t *cpu_set) {
void get_exclusive_cpuset_cores(SchedPolicy policy, cpu_set_t *cpu_set) {
#ifdef ENABLE_CPUSETS
    if (cpusets_enabled()) {
        int i;
        int i;
        cpu_set_t tmp_set;
        cpu_set_t tmp_set;
        get_cpuset_cores_for_policy(policy, cpu_set);
        get_cpuset_cores_for_policy(policy, cpu_set);
@@ -388,10 +387,9 @@ void get_exclusive_cpuset_cores(SchedPolicy policy, cpu_set_t *cpu_set) {
            // Then get the ones only in cpu_set
            // Then get the ones only in cpu_set
            CPU_AND(cpu_set, cpu_set, &tmp_set);
            CPU_AND(cpu_set, cpu_set, &tmp_set);
        }
        }
#else
    } else {
    (void) policy;
        CPU_ZERO(cpu_set);
        CPU_ZERO(cpu_set);
#endif
    }
    return;
    return;
}
}