Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b28ff913 authored by Colin Cross's avatar Colin Cross
Browse files

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
parent 9d9e62cf
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@
#include <sys/cdefs.h>
#include <sys/cdefs.h>
#include <sys/epoll.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <sys/eventfd.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/types.h>
#include <unistd.h>
#include <unistd.h>
@@ -747,6 +748,7 @@ static void mainloop(void) {
}
}


int main(int argc __unused, char **argv __unused) {
int main(int argc __unused, char **argv __unused) {
    mlockall(MCL_FUTURE);
    if (!init())
    if (!init())
        mainloop();
        mainloop();