Improve cpuset support for surfaceflinger.
SurfaceFlinger needs some of its threads in the system-background cpuset and some of its threads (the binder pool) outside of the system-background cpuset in order to improve UI perf/power consumption. Remove surfaceflinger from the system-background cpuset in init.rc and allow a thread to place itself in the system-background cpuset given enough permissions. bug 25745866 Change-Id: I85f7e41c5439e6ad7cc2d355e51f5dfb3a0c7088
This commit is contained in:
parent
1589fa1bda
commit
6eee56ccab
2 changed files with 15 additions and 1 deletions
|
|
@ -61,6 +61,7 @@ static int bg_cgroup_fd = -1;
|
||||||
static int fg_cgroup_fd = -1;
|
static int fg_cgroup_fd = -1;
|
||||||
|
|
||||||
// File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error
|
// File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error
|
||||||
|
static int system_bg_cpuset_fd = -1;
|
||||||
static int bg_cpuset_fd = -1;
|
static int bg_cpuset_fd = -1;
|
||||||
static int fg_cpuset_fd = -1;
|
static int fg_cpuset_fd = -1;
|
||||||
|
|
||||||
|
|
@ -126,6 +127,11 @@ static void __initialize(void) {
|
||||||
fg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
|
fg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
|
||||||
filename = "/dev/cpuset/background/tasks";
|
filename = "/dev/cpuset/background/tasks";
|
||||||
bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
|
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);
|
||||||
|
if (system_bg_cpuset_fd < 0) {
|
||||||
|
SLOGE("initialize of system-bg failed: %s\n", strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -260,6 +266,9 @@ int set_cpuset_policy(int tid, SchedPolicy policy)
|
||||||
case SP_AUDIO_SYS:
|
case SP_AUDIO_SYS:
|
||||||
fd = fg_cpuset_fd;
|
fd = fg_cpuset_fd;
|
||||||
break;
|
break;
|
||||||
|
case SP_SYSTEM:
|
||||||
|
fd = system_bg_cpuset_fd;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fd = -1;
|
fd = -1;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -165,13 +165,19 @@ on init
|
||||||
chown system system /dev/cpuset/foreground
|
chown system system /dev/cpuset/foreground
|
||||||
chown system system /dev/cpuset/foreground/boost
|
chown system system /dev/cpuset/foreground/boost
|
||||||
chown system system /dev/cpuset/background
|
chown system system /dev/cpuset/background
|
||||||
|
chown system system /dev/cpuset/system-background
|
||||||
chown system system /dev/cpuset/tasks
|
chown system system /dev/cpuset/tasks
|
||||||
chown system system /dev/cpuset/foreground/tasks
|
chown system system /dev/cpuset/foreground/tasks
|
||||||
chown system system /dev/cpuset/foreground/boost/tasks
|
chown system system /dev/cpuset/foreground/boost/tasks
|
||||||
chown system system /dev/cpuset/background/tasks
|
chown system system /dev/cpuset/background/tasks
|
||||||
|
chown system system /dev/cpuset/system-background/tasks
|
||||||
|
|
||||||
|
# set system-background to 0775 so SurfaceFlinger can touch it
|
||||||
|
chmod 0775 /dev/cpuset/system-background
|
||||||
chmod 0664 /dev/cpuset/foreground/tasks
|
chmod 0664 /dev/cpuset/foreground/tasks
|
||||||
chmod 0664 /dev/cpuset/foreground/boost/tasks
|
chmod 0664 /dev/cpuset/foreground/boost/tasks
|
||||||
chmod 0664 /dev/cpuset/background/tasks
|
chmod 0664 /dev/cpuset/background/tasks
|
||||||
|
chmod 0664 /dev/cpuset/system-background/tasks
|
||||||
chmod 0664 /dev/cpuset/tasks
|
chmod 0664 /dev/cpuset/tasks
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -646,7 +652,6 @@ service surfaceflinger /system/bin/surfaceflinger
|
||||||
user system
|
user system
|
||||||
group graphics drmrpc
|
group graphics drmrpc
|
||||||
onrestart restart zygote
|
onrestart restart zygote
|
||||||
writepid /dev/cpuset/system-background/tasks
|
|
||||||
|
|
||||||
service drm /system/bin/drmserver
|
service drm /system/bin/drmserver
|
||||||
class main
|
class main
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue