Merge "Enable top-app cpuset support."
This commit is contained in:
commit
88185f9ee8
|
@ -29,6 +29,7 @@ typedef enum {
|
|||
SP_SYSTEM = 2, // can't be used with set_sched_policy()
|
||||
SP_AUDIO_APP = 3,
|
||||
SP_AUDIO_SYS = 4,
|
||||
SP_TOP_APP = 5,
|
||||
SP_CNT,
|
||||
SP_MAX = SP_CNT - 1,
|
||||
SP_SYSTEM_DEFAULT = SP_FOREGROUND,
|
||||
|
|
|
@ -65,6 +65,7 @@ static int fg_cgroup_fd = -1;
|
|||
static int system_bg_cpuset_fd = -1;
|
||||
static int bg_cpuset_fd = -1;
|
||||
static int fg_cpuset_fd = -1;
|
||||
static int ta_cpuset_fd = -1; // special cpuset for top app
|
||||
static int bg_schedboost_fd = -1;
|
||||
static int fg_schedboost_fd = -1;
|
||||
#endif
|
||||
|
@ -133,6 +134,8 @@ static void __initialize(void) {
|
|||
bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
|
||||
filename = "/dev/cpuset/system-background/tasks";
|
||||
system_bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
|
||||
filename = "/dev/cpuset/top-app/tasks";
|
||||
ta_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
|
||||
|
||||
#ifdef USE_SCHEDBOOST
|
||||
filename = "/sys/fs/cgroup/stune/foreground/tasks";
|
||||
|
@ -276,6 +279,10 @@ int set_cpuset_policy(int tid, SchedPolicy policy)
|
|||
fd = fg_cpuset_fd;
|
||||
boost_fd = fg_schedboost_fd;
|
||||
break;
|
||||
case SP_TOP_APP :
|
||||
fd = ta_cpuset_fd;
|
||||
boost_fd = fg_schedboost_fd;
|
||||
break;
|
||||
case SP_SYSTEM:
|
||||
fd = system_bg_cpuset_fd;
|
||||
boost_fd = bg_schedboost_fd;
|
||||
|
@ -337,6 +344,7 @@ int set_sched_policy(int tid, SchedPolicy policy)
|
|||
case SP_FOREGROUND:
|
||||
case SP_AUDIO_APP:
|
||||
case SP_AUDIO_SYS:
|
||||
case SP_TOP_APP:
|
||||
SLOGD("^^^ tid %d (%s)", tid, thread_name);
|
||||
break;
|
||||
case SP_SYSTEM:
|
||||
|
@ -357,6 +365,7 @@ int set_sched_policy(int tid, SchedPolicy policy)
|
|||
case SP_FOREGROUND:
|
||||
case SP_AUDIO_APP:
|
||||
case SP_AUDIO_SYS:
|
||||
case SP_TOP_APP:
|
||||
fd = fg_cgroup_fd;
|
||||
break;
|
||||
default:
|
||||
|
@ -411,6 +420,7 @@ const char *get_sched_policy_name(SchedPolicy policy)
|
|||
[SP_SYSTEM] = " ",
|
||||
[SP_AUDIO_APP] = "aa",
|
||||
[SP_AUDIO_SYS] = "as",
|
||||
[SP_TOP_APP] = "ta",
|
||||
};
|
||||
if ((policy < SP_CNT) && (strings[policy] != NULL))
|
||||
return strings[policy];
|
||||
|
|
|
@ -173,17 +173,23 @@ on init
|
|||
write /dev/cpuset/system-background/cpus 0
|
||||
write /dev/cpuset/system-background/mems 0
|
||||
|
||||
mkdir /dev/cpuset/top-app
|
||||
write /dev/cpuset/top-app/cpus 0
|
||||
write /dev/cpuset/top-app/mems 0
|
||||
|
||||
# change permissions for all cpusets we'll touch at runtime
|
||||
chown system system /dev/cpuset
|
||||
chown system system /dev/cpuset/foreground
|
||||
chown system system /dev/cpuset/foreground/boost
|
||||
chown system system /dev/cpuset/background
|
||||
chown system system /dev/cpuset/system-background
|
||||
chown system system /dev/cpuset/top-app
|
||||
chown system system /dev/cpuset/tasks
|
||||
chown system system /dev/cpuset/foreground/tasks
|
||||
chown system system /dev/cpuset/foreground/boost/tasks
|
||||
chown system system /dev/cpuset/background/tasks
|
||||
chown system system /dev/cpuset/system-background/tasks
|
||||
chown system system /dev/cpuset/top-app/tasks
|
||||
|
||||
# set system-background to 0775 so SurfaceFlinger can touch it
|
||||
chmod 0775 /dev/cpuset/system-background
|
||||
|
@ -192,6 +198,7 @@ on init
|
|||
chmod 0664 /dev/cpuset/foreground/boost/tasks
|
||||
chmod 0664 /dev/cpuset/background/tasks
|
||||
chmod 0664 /dev/cpuset/system-background/tasks
|
||||
chmod 0664 /dev/cpuset/top-app/tasks
|
||||
chmod 0664 /dev/cpuset/tasks
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue