[PATCH 03/10] mm, oom: do not panic on constrained OOMs
From: Michal Hocko
Date: Wed Dec 02 2026 - 04:55:10 EST
From: Michal Hocko <mhocko@xxxxxxxx>
domain (cpuset, mempolicy or memcg) OOMs represent a partial shortage of
memory. There might still be memory available outside of the domain and
therefore panicing at this stage might disrupt otherwise operational
workloads. We already avoid panicing for memcg ooms. Node bound (by
mempolicy or cpusets) ooms shouldn't be any different from that.
Do not panic on any fail to find an oom victim unless this is full
system wide oom (CONSTRAINT_NONE) context.
Fixes: 6f48d0ebd907 ("oom: select task from tasklist for mempolicy ooms")
Reported-by: Chris Mason <mason@xxxxxxxxxx>
Signed-off-by: Michal Hocko <mhocko@xxxxxxxx>
---
mm/oom_kill.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 30c314069d5b..660ab39e1df5 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -1168,10 +1168,11 @@ bool out_of_memory(struct oom_control *oc)
pr_warn("Out of memory and no killable processes...\n");
/*
* If we got here due to an actual allocation at the
- * system level, we cannot survive this and will enter
- * an endless loop in the allocator. Bail out now.
+ * system level without any constrains, we cannot survive this
+ * and will enter an endless loop in the allocator.
+ * Bail out now.
*/
- if (!is_sysrq_oom(oc) && !is_memcg_oom(oc))
+ if (!is_sysrq_oom(oc) && oc->constraint == CONSTRAINT_NONE)
panic("System is deadlocked on memory\n");
}
if (oc->chosen && oc->chosen != (void *)-1UL)
--
2.56.1