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

Commit d87c19f7 authored by San Mehat's avatar San Mehat Committed by Android Git Automerger
Browse files

am 7e63789a: android: cgroups: Don\'t switch threads >= nice 10 when moving all threads to default

Merge commit '7e63789a'

* commit '7e63789a':
  android: cgroups: Don't switch threads >= nice 10 when moving all threads to default
parents 6bfe14de 7e63789a
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -251,10 +251,27 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin
    }

    while ((de = readdir(d))) {
        int t_pid;
        int t_pri;

        if (de->d_name[0] == '.')
            continue;
        t_pid = atoi(de->d_name);

        if (!t_pid) {
            LOGE("Error getting pid for '%s'\n", de->d_name);
            continue;
        }

        t_pri = getpriority(PRIO_PROCESS, t_pid);

        if (grp == ANDROID_TGROUP_DEFAULT &&
            t_pri >= ANDROID_PRIORITY_BACKGROUND) {
            // This task wants to stay at background
            continue;
        }
     
        if (add_pid_to_cgroup(atoi(de->d_name), grp)) {
        if (add_pid_to_cgroup(t_pid, grp)) {
            // If the thread exited on us, ignore it and keep going
            if (errno != ESRCH && errno != ENOENT) {
                signalExceptionForGroupError(env, clazz, errno);