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
Current test will fail in the case when the target process exits before
process_mrelease is called. However this is possible and should not be
treated as an invalid case. Add special handling of this case in the
test.
Bug: 254880957
Test: run lmkd_tests until this case happens
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ica5b28fa52a5f42a771fb9516112e58b66291068
Merged-In: Ica5b28fa52a5f42a771fb9516112e58b66291068
Not boosting kill target's priority can cause priority inversion. Boost
its priority from the reaper thread right after sending a SIGKILL to
prevent priority inversion. Also, using normal priority to the victim
processes. Thus, they won't take too much CPU resource which preempt
UI or important processes.
Bug: 238495258
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I789ec402f038a1b48d25f62f859be69bbddfad16
Merged-In: Ib4665d3df62f58e36686ca134f9ae07836fd6945