diff options
| author | 2018-01-31 16:16:31 -0800 | |
|---|---|---|
| committer | 2018-02-07 11:02:08 -0800 | |
| commit | b2f929d726eaf0f58a3a5c377d0f7bd657cfceaf (patch) | |
| tree | d15ecb733e5313b9527b9f40b063d5c4fae45220 | |
| parent | d46652a2d8f7439f779c4d310cad0c6d050d733a (diff) | |
bind android.bg in system_server to small cores
android.bg in system_server primarily handles PSS collection, which is
not performance critical. Accordingly, bind it to little cores.
However, because threads in zygote-derived applications are only in a
single cpuset at a time, this also means the scheduling policy for
system_servershould never be reset by applyOomAdjLocked(). The only
time this happens is when system_server's ProcessRecord is first
created, and its scheduler configuration is already controlled by
init.rc. Configure the right defaults for system_server's scheduling
group so it's never modified from applyOomAdjLocked().
Test: android.bg is in background, rest of system_server is in fg
bug 70859548
Change-Id: Id8582e6d493c6b2d3390fdc45ac2396390744f06
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 99f36d0a8b1b..2e78db98308b 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -3005,6 +3005,16 @@ public class ActivityManagerService extends IActivityManager.Stub Watchdog.getInstance().addMonitor(this); Watchdog.getInstance().addThread(mHandler); + + // bind background thread to little cores + // this is expected to fail inside of framework tests because apps can't touch cpusets directly + try { + Process.setThreadGroupAndCpuset(BackgroundThread.get().getThreadId(), + Process.THREAD_GROUP_BG_NONINTERACTIVE); + } catch (Exception e) { + Slog.w(TAG, "Setting background thread cpuset failed"); + } + } protected ActivityStackSupervisor createStackSupervisor() { @@ -12648,6 +12658,9 @@ public class ActivityManagerService extends IActivityManager.Stub if (!mBooted && !mBooting && userId == UserHandle.USER_SYSTEM && (info.flags & PERSISTENT_MASK) == PERSISTENT_MASK) { + // The system process is initialized to SCHED_GROUP_DEFAULT in init.rc. + r.curSchedGroup = ProcessList.SCHED_GROUP_DEFAULT; + r.setSchedGroup = ProcessList.SCHED_GROUP_DEFAULT; r.persistent = true; r.maxAdj = ProcessList.PERSISTENT_PROC_ADJ; } |