lmkd: prevent the main thread from reaping synchronously

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
This commit is contained in:
Suren Baghdasaryan 2022-10-14 19:11:22 +00:00
parent 67c467d4ec
commit 1c96a31917
1 changed files with 1 additions and 1 deletions

View File

@ -202,7 +202,7 @@ int Reaper::kill(const struct target_proc& target, bool synchronous) {
return result; return result;
} }
return is_reaping_supported() ? process_mrelease(target.pidfd, 0) : 0; return 0;
} }
Reaper::target_proc Reaper::dequeue_request() { Reaper::target_proc Reaper::dequeue_request() {