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

Commit 88ef9f06 authored by Joel Fernandes's avatar Joel Fernandes
Browse files

libcutils: Add support for RT schedtune group



Add an SP_RT_APP group which will be used to provide minimum
capacity guarantees to RT tasks sensitive to frequency drops
such as synthesizer workloads.

Bug: 33085313
Change-Id: I07cca79e52661d1325a1db9ef3b61eb0f8d20989
Signed-off-by: default avatarJoel Fernandes <joelaf@google.com>
parent f50d1091
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ typedef enum {
    SP_AUDIO_APP  = 3,
    SP_AUDIO_SYS  = 4,
    SP_TOP_APP    = 5,
    SP_RT_APP     = 6,
    SP_CNT,
    SP_MAX        = SP_CNT - 1,
    SP_SYSTEM_DEFAULT = SP_FOREGROUND,
+10 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ static int ta_cpuset_fd = -1; // special cpuset for top app
static int bg_schedboost_fd = -1;
static int fg_schedboost_fd = -1;
static int ta_schedboost_fd = -1;
static int rt_schedboost_fd = -1;

/* Add tid to the scheduling group defined by the policy */
static int add_tid_to_cgroup(int tid, int fd)
@@ -173,6 +174,8 @@ static void __initialize() {
                fg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
                filename = "/dev/stune/background/tasks";
                bg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
                filename = "/dev/stune/rt/tasks";
                rt_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
            }
        }
    }
@@ -408,6 +411,9 @@ int set_sched_policy(int tid, SchedPolicy policy)
    case SP_SYSTEM:
        SLOGD("/// tid %d (%s)", tid, thread_name);
        break;
    case SP_RT_APP:
	SLOGD("RT  tid %d (%s)", tid, thread_name);
	break;
    default:
        SLOGD("??? tid %d (%s)", tid, thread_name);
        break;
@@ -428,6 +434,9 @@ int set_sched_policy(int tid, SchedPolicy policy)
        case SP_TOP_APP:
            boost_fd = ta_schedboost_fd;
            break;
        case SP_RT_APP:
	    boost_fd = rt_schedboost_fd;
	    break;
        default:
            boost_fd = -1;
            break;
@@ -472,6 +481,7 @@ const char *get_sched_policy_name(SchedPolicy policy)
       [SP_AUDIO_APP]  = "aa",
       [SP_AUDIO_SYS]  = "as",
       [SP_TOP_APP]    = "ta",
       [SP_RT_APP]    = "rt",
    };
    if ((policy < SP_CNT) && (strings[policy] != NULL))
        return strings[policy];