[PATCH memcg 1/3] mm: do not firce global OOM from inside dying tasks

From: Vasily Averin
Date: Wed Oct 20 2021 - 08:12:44 EST


There is no sense to force global OOM if current task is dying.

Signed-off-by: Vasily Averin <vvs@xxxxxxxxxxxxx>
---
mm/oom_kill.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 831340e7ad8b..1deef8c7a71b 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -1137,6 +1137,9 @@ void pagefault_out_of_memory(void)
if (mem_cgroup_oom_synchronize(true))
return;

+ if (fatal_signal_pending(current))
+ return;
+
if (!mutex_trylock(&oom_lock))
return;
out_of_memory(&oc);
--
2.32.0