lmkd: kill a process if zoneinfo can't be read
Opening /proc/zoneinfo may return -ENOMEM under memory pressure,
assume something needs to be killed if that happens.
Bug: 16236289
Change-Id: I25aab09f4c3f2b9e176eaaeca94fd6bd790dad4e
diff --git a/lmkd/lmkd.c b/lmkd/lmkd.c
index 2362cbf..a534a24 100644
--- a/lmkd/lmkd.c
+++ b/lmkd/lmkd.c
@@ -660,8 +660,10 @@
if (time(NULL) - kill_lasttime < KILL_TIMEOUT)
return;
- if (zoneinfo_parse(&mi) < 0)
- return;
+ while (zoneinfo_parse(&mi) < 0) {
+ // Failed to read /proc/zoneinfo, assume ENOMEM and kill something
+ find_and_kill_process(0, 0, true);
+ }
other_free = mi.nr_free_pages - mi.totalreserve_pages;
other_file = mi.nr_file_pages - mi.nr_shmem;