OSDN Git Service

Lower the priority of the LazyTaskWriter thread.
authorRiley Andrews <riandrews@google.com>
Wed, 3 Jun 2015 01:24:48 +0000 (18:24 -0700)
committerRiley Andrews <riandrews@google.com>
Wed, 3 Jun 2015 18:13:18 +0000 (18:13 +0000)
This worker thread shouldn't be prioritized at the same level as user
tasks, preemptions of ui threads may result. Additionally, if we lower
its priority level, it will be scheduled on more efficient cores
in big little systems.

Change-Id: I49a7df6fb43d6c067aeacf9ff0cbd5477cb42f7d

services/core/java/com/android/server/am/TaskPersister.java

index ef1559a..aa154a7 100644 (file)
@@ -33,6 +33,7 @@ import android.util.AtomicFile;
 import android.util.Slog;
 import android.util.SparseArray;
 import android.util.Xml;
+import android.os.Process;
 
 import com.android.internal.util.FastXmlSerializer;
 import com.android.internal.util.XmlUtils;
@@ -471,6 +472,7 @@ public class TaskPersister {
 
         @Override
         public void run() {
+            Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
             ArraySet<Integer> persistentTaskIds = new ArraySet<Integer>();
             while (true) {
                 // We can't lock mService while holding TaskPersister.this, but we don't want to