Call applyOomAdjLSP starting from the least recently used process.
With this change, in cases where both client and service's oom scores are updated, their order of killing by LMDK will reflect the process LRU order, which means least recently used processes will be killed before most recenlly used processes when they both have the same oom score. There are some cases where client's oom score is not updated, and its position in LMKD queue does not get updated, resulting service to appear closer to the most recently used end and getting killed after the client (again if they have the same oom score, i.e. bound with BIND_IMPORTANT flag). These cases will not benefit from this change, but also would not get worse, since this is the current behavior before this CL. But in many cases, for example when app goes to background and get prev oom score, or when the app gets cached, both the client and service processes get updated. And this is when the most killing happen, increasing the benefits of this change, without any side effects. Also, this change will only be helpful if LMKD keeps having FIFO killing order. Bug: 378580264 Test: atest MockingOomAdjusterTests#testUpdateOomAdj_ApplyOomAdjInCorrectOrder Flag: com.android.server.am.fix_apply_oomadj_order Change-Id: I53d06354abaf0d5ce34f8d7a006579226c9254ae
Loading
Please register or sign in to comment