summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Murray2015-11-10 16:31:09 -0600
committerTim Murray2016-01-22 16:06:50 -0600
commit4284f9f3a3d471208d7a9341056e4d7af886dab3 (patch)
treea4b8375cc7d01296fd2a0624bc25992264ba8e6d /libcutils/sched_policy.c
parent3b299d55e75e81453d31a41b69dddf8ff3f06bbb (diff)
downloadplatform-system-core-4284f9f3a3d471208d7a9341056e4d7af886dab3.tar.gz
platform-system-core-4284f9f3a3d471208d7a9341056e4d7af886dab3.tar.xz
platform-system-core-4284f9f3a3d471208d7a9341056e4d7af886dab3.zip
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
Diffstat (limited to 'libcutils/sched_policy.c')
-rw-r--r--libcutils/sched_policy.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c
index 6bba3a7b1..280a0834b 100644
--- a/libcutils/sched_policy.c
+++ b/libcutils/sched_policy.c
@@ -62,6 +62,7 @@ static int fg_cgroup_fd = -1;
62 62
63#ifdef USE_CPUSETS 63#ifdef USE_CPUSETS
64// File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error 64// File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error
65static int system_bg_cpuset_fd = -1;
65static int bg_cpuset_fd = -1; 66static int bg_cpuset_fd = -1;
66static int fg_cpuset_fd = -1; 67static int fg_cpuset_fd = -1;
67static int bg_schedboost_fd = -1; 68static int bg_schedboost_fd = -1;
@@ -130,6 +131,9 @@ static void __initialize(void) {
130 fg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC); 131 fg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
131 filename = "/dev/cpuset/background/tasks"; 132 filename = "/dev/cpuset/background/tasks";
132 bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC); 133 bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
134 filename = "/dev/cpuset/system-background/tasks";
135 system_bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
136
133#ifdef USE_SCHEDBOOST 137#ifdef USE_SCHEDBOOST
134 filename = "/sys/fs/cgroup/stune/foreground/tasks"; 138 filename = "/sys/fs/cgroup/stune/foreground/tasks";
135 fg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC); 139 fg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
@@ -138,7 +142,6 @@ static void __initialize(void) {
138#endif 142#endif
139 } 143 }
140#endif 144#endif
141
142} 145}
143 146
144/* 147/*
@@ -273,6 +276,10 @@ int set_cpuset_policy(int tid, SchedPolicy policy)
273 fd = fg_cpuset_fd; 276 fd = fg_cpuset_fd;
274 boost_fd = fg_schedboost_fd; 277 boost_fd = fg_schedboost_fd;
275 break; 278 break;
279 case SP_SYSTEM:
280 fd = system_bg_cpuset_fd;
281 boost_fd = bg_schedboost_fd;
282 break;
276 default: 283 default:
277 boost_fd = fd = -1; 284 boost_fd = fd = -1;
278 break; 285 break;