ANDROID: mm/oom_kill: allow process_mrelease reclaim memory in parallel with exit_mmap

To allow process_mrelease to reap targeted mm in parallel with exit_mmap
mark the victim with MMF_OOM_VICTIM flag.

Bug: 189803002
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I89cf5f8fbeeb18b93a340b9ebe7f200837ebe846
This commit is contained in:
Suren Baghdasaryan
2021-11-15 15:39:21 -08:00
parent f4f2c619d5
commit e99926fdfa

View File

@@ -1233,6 +1233,12 @@ SYSCALL_DEFINE2(process_mrelease, int, pidfd, unsigned int, flags)
mm = p->mm; mm = p->mm;
mmgrab(mm); mmgrab(mm);
/*
* If we are too late and exit_mmap already checked mm_is_oom_victim
* then will block on mmap_read_lock until exit_mmap releases mmap_lock
*/
set_bit(MMF_OOM_VICTIM, &mm->flags);
if (task_will_free_mem(p)) if (task_will_free_mem(p))
reap = true; reap = true;
else { else {