Merge "Fix for incorrect cycle evaluation in computeOomAdj DO NOT MERGE" into pi-dev
am: 9d77aaec85
Change-Id: Ie4e65d42c44a2a45418f5bd27155efc6c4869276
This commit is contained in:
@@ -22911,6 +22911,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
// The process is being computed, so there is a cycle. We cannot
|
||||
// rely on this process's state.
|
||||
app.containsCycle = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -22935,6 +22936,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
final int logUid = mCurOomAdjUid;
|
||||
|
||||
int prevAppAdj = app.curAdj;
|
||||
int prevProcState = app.curProcState;
|
||||
|
||||
if (app.maxAdj <= ProcessList.FOREGROUND_APP_ADJ) {
|
||||
// The max adjustment doesn't allow this app to be anything
|
||||
@@ -23413,11 +23415,16 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
ProcessRecord client = cr.binding.client;
|
||||
computeOomAdjLocked(client, cachedAdj, TOP_APP, doingAll, now);
|
||||
if (client.containsCycle) {
|
||||
// We've detected a cycle. We should ignore this connection and allow
|
||||
// this process to retry computeOomAdjLocked later in case a later-checked
|
||||
// connection from a client would raise its priority legitimately.
|
||||
// We've detected a cycle. We should retry computeOomAdjLocked later in
|
||||
// case a later-checked connection from a client would raise its
|
||||
// priority legitimately.
|
||||
app.containsCycle = true;
|
||||
continue;
|
||||
// If the client has not been completely evaluated, skip using its
|
||||
// priority. Else use the conservative value for now and look for a
|
||||
// better state in the next iteration.
|
||||
if (client.completedAdjSeq < mAdjSeq) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
int clientAdj = client.curRawAdj;
|
||||
int clientProcState = client.curProcState;
|
||||
@@ -23640,11 +23647,16 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
computeOomAdjLocked(client, cachedAdj, TOP_APP, doingAll, now);
|
||||
if (client.containsCycle) {
|
||||
// We've detected a cycle. We should ignore this connection and allow
|
||||
// this process to retry computeOomAdjLocked later in case a later-checked
|
||||
// connection from a client would raise its priority legitimately.
|
||||
// We've detected a cycle. We should retry computeOomAdjLocked later in
|
||||
// case a later-checked connection from a client would raise its
|
||||
// priority legitimately.
|
||||
app.containsCycle = true;
|
||||
continue;
|
||||
// If the client has not been completely evaluated, skip using its
|
||||
// priority. Else use the conservative value for now and look for a
|
||||
// better state in the next iteration.
|
||||
if (client.completedAdjSeq < mAdjSeq) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
int clientAdj = client.curRawAdj;
|
||||
int clientProcState = client.curProcState;
|
||||
@@ -23876,8 +23888,8 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
app.foregroundActivities = foregroundActivities;
|
||||
app.completedAdjSeq = mAdjSeq;
|
||||
|
||||
// if curAdj is less than prevAppAdj, then this process was promoted
|
||||
return app.curAdj < prevAppAdj;
|
||||
// if curAdj or curProcState improved, then this process was promoted
|
||||
return app.curAdj < prevAppAdj || app.curProcState < prevProcState;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24930,7 +24942,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
// - Continue retrying until no process was promoted.
|
||||
// - Iterate from least important to most important.
|
||||
int cycleCount = 0;
|
||||
while (retryCycles) {
|
||||
while (retryCycles && cycleCount < 10) {
|
||||
cycleCount++;
|
||||
retryCycles = false;
|
||||
|
||||
@@ -24945,12 +24957,14 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
for (int i=0; i<N; i++) {
|
||||
ProcessRecord app = mLruProcesses.get(i);
|
||||
if (!app.killedByAm && app.thread != null && app.containsCycle == true) {
|
||||
|
||||
if (computeOomAdjLocked(app, ProcessList.UNKNOWN_ADJ, TOP_APP, true, now)) {
|
||||
retryCycles = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=N-1; i>=0; i--) {
|
||||
ProcessRecord app = mLruProcesses.get(i);
|
||||
if (!app.killedByAm && app.thread != null) {
|
||||
|
||||
Reference in New Issue
Block a user