summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Crane <cranes@google.com>2023-07-21 22:21:31 +0000
committerStephen Crane <cranes@google.com>2023-07-21 22:53:01 +0000
commit209890c07d40651e5c44eb8677c6c4e555b35488 (patch)
treeafb25388b9fc2b89f0812a1304877d42de66d4a7
parent1310d7a6d6d665299f4aa8b485809a78eba0ad9b (diff)
downloadcore-209890c07d40651e5c44eb8677c6c4e555b35488.tar.gz
storageproxyd: Start only a single binder thread
We only need a single binder thread to receive notifications, so we should set the thread pool max to 0 rather than 1. startThreadPool() starts one thread + the max count. Test: m storageproxyd Bug: 281951047 Fixes: 292030372 (cherry picked from https://android-review.googlesource.com/q/commit:b05b8706714a6e7eb64890e0bee012dbc69f72be) Merged-In: I53a90eaa2aa69469fd3a00b6da0d7061318c8ba9 Change-Id: I53a90eaa2aa69469fd3a00b6da0d7061318c8ba9
-rw-r--r--trusty/storage/proxy/proxy.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/trusty/storage/proxy/proxy.c b/trusty/storage/proxy/proxy.c
index 3b744ec94..67e935e39 100644
--- a/trusty/storage/proxy/proxy.c
+++ b/trusty/storage/proxy/proxy.c
@@ -243,9 +243,12 @@ int main(int argc, char* argv[]) {
* Start binder threadpool. At least one extra binder thread is needed to
* connect to the wakelock service without relying on polling. If we poll on
* the main thread we end up pausing for at least 1s even if the service
- * starts faster.
+ * starts faster. We set the max thread count to 0 because startThreadPool
+ * "Starts one thread, PLUS those requested in setThreadPoolMaxThreadCount,
+ * PLUS those manually requested in joinThreadPool." We only need a single
+ * binder thread to receive notifications on.
*/
- ABinderProcess_setThreadPoolMaxThreadCount(1);
+ ABinderProcess_setThreadPoolMaxThreadCount(0);
ABinderProcess_startThreadPool();
/* initialize secure storage directory */