With Android U removing AMS kills, lmkd has additional duty to kill
cached apps which previously were killed by AMS. The former logic is
not proactive enough and leads to too many cached apps contributing
to memory pressure.
Implement additional logic to kill cached apps (excluding previous
foreground apps) when low watermark is breached or when device is
thrashing.
Bug: 300660611
Change-Id: I356eac1fe6d44dad292a7ea2fadee69a5be61479
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Since killing and reaping of a process is done in separate threads, it's
possible that the reaping report will be ordered before the kill report.
Adjust the test to handle this case by checking for the reaping report
in the entire log output.
Bug: 296555636
Change-Id: I5549b05392e08655655d4aecc4fadec281c489af
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
In rare cases the process reaping time is short enough that it is
reported as 0. Prevent the test from failing in this rare case.
Bug: 296555636
Change-Id: I8484958eb9561ba345008195be8b6a7bd94e9ef3
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
As a result of experiments, the default relation between critical and
normal thrashing limits has been shown to be insufficient. Increase the
relation from 2x to 3x.
Bug: 194316048
Change-Id: I19877e0df56be07f3f503688f408f5f91f4b1e67
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
In rare cases it's possible that pgscan is not changing because inactive
LRU is empty and can't be refilled from the active LRU due to all
pages being hot. In such conditions pgscan_kswapd/pgscan_direct will
not change while pgrefill will be increasing due to active LRU being
scanned. Lmkd would incorrectly treat this situation as if no reclaim
activity happened.
Change lmkd to check pgrefill as well to detect such conditions.
Bug: 288383787
Change-Id: I6b49607429e2f673bba2645ccddff1a141afbcd1
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
To save CPU cycles during boot for low resource device a new
configuration is added to delay initialization of monitoring until boot
is complete.
Bug: 288566858
Test: Build, boot and verified boot logs to confirm the behavior.
Merged-In: I17cfbf4c7f83bc80dd92a99dfb0254a7e20289be
Change-Id: I17cfbf4c7f83bc80dd92a99dfb0254a7e20289be
The LmkStateChanged atom was historically used to mark lmk activity
and trigger additional stats polling. For more than a year this has
not been used at all (as statsd supported event-based triggering).
Remove unnecessary functionality.
Bug: 278174420
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I9f7f56711fabb751cf7a57ea7279759bcc4a3dff
Previously the min_oom score of the candidate search was sent to
lmkd_free_memory_before_kill_hook. This is incorrect as the hook expects
the actual oom score of the process.
Bug: b/273670531
Test: cq
Change-Id: Id72c8b39f9c745a8f20fde15266857cb2d2222bf
Doesn't need to be in 'presubmit-large' as it's a small and quick test.
Change-Id: I7a6b78cf3174993361f50d8d7adfdf86c9d20e28
Test: presubmit
Bug: 270214959
am skip reason: Merged-In Ib4665d3df62f58e36686ca134f9ae07836fd6945 with SHA-1 779a550826 is already in history
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2338252
Change-Id: Ifb083de77f91ac9fbc6cf8582de6e0414276448c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ib4665d3df62f58e36686ca134f9ae07836fd6945 with SHA-1 779a550826 is already in history
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2338252
Change-Id: I7f252acc244dc53f3d4a0f8ba282178ad3c4db82
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ib4665d3df62f58e36686ca134f9ae07836fd6945 with SHA-1 779a550826 is already in history
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2338252
Change-Id: I08a7a0c553ee72e3ec6d617062c4e3a9de7ea46c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ib4665d3df62f58e36686ca134f9ae07836fd6945 with SHA-1 779a550826 is already in history
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2338252
Change-Id: I549e8528915d96b31385634273ac5d56fa901c5c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ib4665d3df62f58e36686ca134f9ae07836fd6945 with SHA-1 779a550826 is already in history
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2338252
Change-Id: I6729e72a0a01daa1391e683b440beb8813b3884f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ib4665d3df62f58e36686ca134f9ae07836fd6945 with SHA-1 779a550826 is already in history
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2338252
Change-Id: I4e6fa10f733b695f4fb35a43f5373f9dcb93fc15
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ib4665d3df62f58e36686ca134f9ae07836fd6945 with SHA-1 779a550826 is already in history
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2338252
Change-Id: I6584c43f73918c030d8c04b42c3cfc5b1e8b9e59
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ib4665d3df62f58e36686ca134f9ae07836fd6945 with SHA-1 779a550826 is already in history
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2338252
Change-Id: Ibed362db6eebbfe38d39dde837c9343bf7db7e83
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
lmkd main thread is running at RT priority to prevent it from being
blocked by other processes. However when all reaper threads are busy,
lmkd will kill and reap the memory of the target process from the
context of the main thread and that can cause two issues:
1. lmkd main thread gets blocked for considerable duration.
2. lmkd main and reaper threads might monopolize CPUs.
To prevent these issues, when all reaper threads are busy, lmkd will
send a SIGKILL but will not synchronously reap the memory of the target
process.
Bug: 238495258
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I351c01229152946969e646b538a2494656c0cc85
Merged-In: I351c01229152946969e646b538a2494656c0cc85