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
This commit is contained in:
Colin Cross 2014-07-11 17:16:56 -07:00
parent 16b0946da1
commit f8857cc24a
1 changed files with 4 additions and 2 deletions

View File

@ -660,8 +660,10 @@ static void mp_event(uint32_t events __unused) {
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;