summaryrefslogtreecommitdiff
path: root/core/java/android/os/Process.java
diff options
context:
space:
mode:
authorJoel Fernandes <joelaf@google.com>2017-04-04 16:32:15 -0700
committerJoel Fernandes <joelaf@google.com>2017-04-05 20:25:43 -0700
commit474d311cb098e86c078c3f615e1161e2854f1847 (patch)
tree53c53a24e076a245425be4fcb17d8f9e8dbbdcee /core/java/android/os/Process.java
parent55ef06b2f481731c98891138d1d18f91c281db6d (diff)
Set android.display thread to top-app cpusets and schedtune group
android.display being in the foreground cpuset group is an issue. As seen on M/S, during heavily CPU load it is not given core 3 even though it might be free and causes jank. This patch adds the thread to the top-app group to ensure it is placed on all cores during scheduling decisions. Doing this required a couple of changes: - new API to set per-thread cpusets - changes to DisplayManagerService to set the thread to top-app group - changes to SystemServer to set the policy toward the end, as doing it during start of the DisplayManagerService was in issue (issue being SystemServer calls setSystemProcess.. -> setProcessGroup which overrides the group settings for threads in the system server process, including android.display) Bug: 36631902 Test: Boot and make sure android.display thread is in the top-app group Change-Id: Icc394ea0ffcf159d11728ad38de114234a29d20f Signed-off-by: Joel Fernandes <joelaf@google.com>
Diffstat (limited to 'core/java/android/os/Process.java')
-rw-r--r--core/java/android/os/Process.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 31376587e144..7a709ed59b15 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -660,7 +660,7 @@ public class Process {
* @hide
* @param tid The identifier of the thread to change.
* @param group The target group for this thread from THREAD_GROUP_*.
- *
+ *
* @throws IllegalArgumentException Throws IllegalArgumentException if
* <var>tid</var> does not exist.
* @throws SecurityException Throws SecurityException if your process does
@@ -676,6 +676,21 @@ public class Process {
throws IllegalArgumentException, SecurityException;
/**
+ * Sets the scheduling group and the corresponding cpuset group
+ * @hide
+ * @param tid The identifier of the thread to change.
+ * @param group The target group for this thread from THREAD_GROUP_*.
+ *
+ * @throws IllegalArgumentException Throws IllegalArgumentException if
+ * <var>tid</var> does not exist.
+ * @throws SecurityException Throws SecurityException if your process does
+ * not have permission to modify the given thread, or to use the given
+ * priority.
+ */
+ public static final native void setThreadGroupAndCpuset(int tid, int group)
+ throws IllegalArgumentException, SecurityException;
+
+ /**
* Sets the scheduling group for a process and all child threads
* @hide
* @param pid The identifier of the process to change.