From 763b4d11af6469bd7b3bd5a307a3c4a744e63a5a Mon Sep 17 00:00:00 2001 From: Vinayak Menon Date: Fri, 23 Oct 2020 16:42:28 +0530 Subject: [PATCH] mm: oom: wait for exit of killed current task Current task in OOM path could be holding enough memory that is not reapable by oom reaper. Fail the allocation and let the task exit before triggering OOM. Change-Id: Ie00911548c5b16a430767f0b60761d839fc43f78 Signed-off-by: Vinayak Menon --- mm/oom_kill.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 1eefd8959121..b7f119359db9 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1160,6 +1160,10 @@ bool out_of_memory(struct oom_control *oc) CONFIG_OOM_TASK_PRIORITY_ADJ_LIMIT); oc->min_kill_adj = prev_min_kill_adj; oc->chosen_points = 0; + if (tsk_is_oom_victim(current)) { + pr_warn_ratelimited("current killed, retry\n"); + return true; + } } }