lmkd: make lmkd SCHED_FIFO
If kswapd runs more than lmkd it may throw away all page cache pages
before lmkd gets a chance to kill a process. Make lmkd SCHED_FIFO
so it can react quickly to kernel low memory notifications.
Bug: 16236289
Change-Id: I46767b4ec81ef8638d0c9e47d168a68b62e3cac5
diff --git a/lmkd/lmkd.c b/lmkd/lmkd.c
index a952855..a1261d1 100644
--- a/lmkd/lmkd.c
+++ b/lmkd/lmkd.c
@@ -748,7 +748,12 @@
}
int main(int argc __unused, char **argv __unused) {
+ struct sched_param param = {
+ .sched_priority = 1,
+ };
+
mlockall(MCL_FUTURE);
+ sched_setscheduler(0, SCHED_FIFO, ¶m);
if (!init())
mainloop();