From 1c96a319175b346367be53bd97eb68fad9ed4077 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Fri, 14 Oct 2022 19:11:22 +0000 Subject: [PATCH] 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 Change-Id: I351c01229152946969e646b538a2494656c0cc85 --- reaper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reaper.cpp b/reaper.cpp index f9bb52a..bd1d6f6 100644 --- a/reaper.cpp +++ b/reaper.cpp @@ -202,7 +202,7 @@ int Reaper::kill(const struct target_proc& target, bool synchronous) { return result; } - return is_reaping_supported() ? process_mrelease(target.pidfd, 0) : 0; + return 0; } Reaper::target_proc Reaper::dequeue_request() {