From c405900f878fffeaf68309a2c3edb2b46d837fdd Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 11 Jul 2014 17:15:44 -0700 Subject: [PATCH] lmkd: mlock all memory Use mlockall(MCL_FUTURE) to lock all lmkd pages in memory. This avoids lmkd thrashing when the system is low on memory. As a side effect, it will also keep the .text sections of liblog, libm, libc, and libprocessgroup in memory at all times. Bug: 16236289 Change-Id: Idd70557efa4b1e14bc86f14220672a30f6c956e3 --- lmkd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lmkd.c b/lmkd.c index 1aeb182..a952855 100644 --- a/lmkd.c +++ b/lmkd.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -747,6 +748,7 @@ static void mainloop(void) { } int main(int argc __unused, char **argv __unused) { + mlockall(MCL_FUTURE); if (!init()) mainloop();