diff options
| author | 2010-02-12 19:30:02 -0800 | |
|---|---|---|
| committer | 2010-02-16 10:54:49 -0800 | |
| commit | 5ce7d28a077363b656fecdd1983775aca61e9032 (patch) | |
| tree | a2a3def9ce047c3575984ab90a0762fcf7e4bca9 | |
| parent | 3d0ff09e35521a97ec1cfe14d57c6868e271fe9a (diff) | |
Small oom_adj tweaks.
Include a proper name for processes that are in the background
with running services that have been running for a long time (instead
of showing them as bg-empty).
Batch together multiple processes into the same background bin when
there are significantly more processes than bins. Arguably this
should be smarter and base the binning on the number of background/empty
processes instead of the total count, but this should be good
enough for now.
| -rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index d0f6a7c03b57..b1d77f58f1eb 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -13463,6 +13463,12 @@ public final class ActivityManagerService extends ActivityManagerNative implemen app.hidden = false; } } + // If we have let the service slide into the background + // state, still have some text describing what it is doing + // even though the service no longer has an impact. + if (adj > SECONDARY_SERVER_ADJ) { + app.adjType = "started-bg-services"; + } } if (s.connections.size() > 0 && (adj > FOREGROUND_APP_ADJ || schedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE)) { @@ -13853,6 +13859,15 @@ public final class ActivityManagerService extends ActivityManagerNative implemen mAdjSeq++; + // Let's determine how many processes we have running vs. + // how many slots we have for background processes; we may want + // to put multiple processes in a slot of there are enough of + // them. + int numSlots = HIDDEN_APP_MAX_ADJ - HIDDEN_APP_MIN_ADJ + 1; + int factor = (mLruProcesses.size()-4)/numSlots; + if (factor < 1) factor = 1; + int step = 0; + // First try updating the OOM adjustment for each of the // application processes based on their current state. int i = mLruProcesses.size(); @@ -13864,7 +13879,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if (updateOomAdjLocked(app, curHiddenAdj, TOP_APP)) { if (curHiddenAdj < EMPTY_APP_ADJ && app.curAdj == curHiddenAdj) { - curHiddenAdj++; + step++; + if (step >= factor) { + step = 0; + curHiddenAdj++; + } } } else { didOomAdj = false; |