summaryrefslogtreecommitdiffstats
path: root/lmkd
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2014-07-11 17:15:44 -0700
committerColin Cross <ccross@android.com>2014-07-14 16:39:56 -0700
commitb28ff9131363f7b4a698990da5748b2a88c3ed35 (patch)
tree828ca0e2db67e0549c0882eb0699ad376c8f2c13 /lmkd
parent9d9e62cf376cf3f70ebf2a11335c02cc155416bc (diff)
downloadsystem_core-b28ff9131363f7b4a698990da5748b2a88c3ed35.zip
system_core-b28ff9131363f7b4a698990da5748b2a88c3ed35.tar.gz
system_core-b28ff9131363f7b4a698990da5748b2a88c3ed35.tar.bz2
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
Diffstat (limited to 'lmkd')
-rw-r--r--lmkd/lmkd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lmkd/lmkd.c b/lmkd/lmkd.c
index 1aeb182..a952855 100644
--- a/lmkd/lmkd.c
+++ b/lmkd/lmkd.c
@@ -26,6 +26,7 @@
#include <sys/cdefs.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
+#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
@@ -747,6 +748,7 @@ static void mainloop(void) {
}
int main(int argc __unused, char **argv __unused) {
+ mlockall(MCL_FUTURE);
if (!init())
mainloop();