Skip to contentSkip to conversation

mm, oom: OOM sysrq should always kill a process

PATCH Applied Jann Horn 2 participants 2 messages Jan 6, 2022

Subsystems (2)
lore
Share & tools
lore

Jann Horn

author
#0 lore raw

PATCH v3 1/1 mm, oom: OOM sysrq should always kill a process

The OOM kill sysrq (alt+sysrq+F) should allow the user to kill the process with the highest OOM badness with a single execution.

However, at the moment, the OOM kill can bail out if an OOM notifier (e.g. the i915 one) says that it reclaimed a tiny amount of memory from somewhere. That's probably not what the user wants, so skip the bailout if the OOM was triggered via sysrq.

---
 mm/oom_kill.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/oom_kill.c +1 -1
index 1ddabefcfb5a..3c480b24a93c 100644
@@ -1057,7 +1057,7 @@ bool out_of_memory(struct oom_control *oc)
 
 	if (!is_memcg_oom(oc)) {
 		blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
-		if (freed > 0)
+		if (freed > 0 && !is_sysrq_oom(oc))
 			/* Got some memory back in the last second. */
 			return true;
 	}

base-commit: c9e6606c7fe92b50a02ce51dda82586ebdf99b48

Signature · 1 line
2.34.1.448.ga2b2bfdf31-goog
reviewer Acked-by on v3 1/1
#1 lore raw
Quoted 10 lines · Jann Horn

The OOM kill sysrq (alt+sysrq+F) should allow the user to kill the process with the highest OOM badness with a single execution.

However, at the moment, the OOM kill can bail out if an OOM notifier (e.g. the i915 one) says that it reclaimed a tiny amount of memory from somewhere. That's probably not what the user wants, so skip the bailout if the OOM was triggered via sysrq.