Set cpuset from surfaceflinger.
SurfaceFlinger shouldn't be limited to little cores exclusively, as the
binder threads should be placed on big cores when they are in the
critical path for a RenderThread.
bug 25745866
Change-Id: I9fb65f6d951733f91b4735ff27018411b58b2bfb
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
index 17ca10e..d70b069 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -124,6 +124,10 @@
LOCAL_INIT_RC := surfaceflinger.rc
+ifneq ($(ENABLE_CPUSETS),)
+ LOCAL_CFLAGS += -DENABLE_CPUSETS
+endif
+
LOCAL_SRC_FILES := \
main_surfaceflinger.cpp
diff --git a/services/surfaceflinger/main_surfaceflinger.cpp b/services/surfaceflinger/main_surfaceflinger.cpp
index ca81aaa..4cd7aeb 100644
--- a/services/surfaceflinger/main_surfaceflinger.cpp
+++ b/services/surfaceflinger/main_surfaceflinger.cpp
@@ -42,6 +42,13 @@
set_sched_policy(0, SP_FOREGROUND);
+#ifdef ENABLE_CPUSETS
+ // Put most SurfaceFlinger threads in the system-background cpuset
+ // Keeps us from unnecessarily using big cores
+ // Do this after the binder thread pool init
+ set_cpuset_policy(0, SP_SYSTEM);
+#endif
+
// initialize before clients can connect
flinger->init();
diff --git a/services/surfaceflinger/surfaceflinger.rc b/services/surfaceflinger/surfaceflinger.rc
index 1d6e20f..2b4ea2a 100644
--- a/services/surfaceflinger/surfaceflinger.rc
+++ b/services/surfaceflinger/surfaceflinger.rc
@@ -3,4 +3,4 @@
user system
group graphics drmrpc readproc
onrestart restart zygote
- writepid /dev/cpuset/system-background/tasks /sys/fs/cgroup/stune/foreground/tasks
+ writepid /sys/fs/cgroup/stune/foreground/tasks