The patch titled Subject: mm, oom: OOM sysrq should always kill a process has been added to the -mm tree. Its filename is mm-oom-oom-sysrq-should-always-kill-a-process.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-oom-oom-sysrq-should-always-kill-a-process.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-oom-oom-sysrq-should-always-kill-a-process.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Jann Horn <jannh@xxxxxxxxxx> Subject: 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. As documented in struct oom_control, order == -1 means the oom kill is required by sysrq. So check for that, and if it's true, don't bail out no matter what the OOM notifiers say. Link: https://lkml.kernel.org/r/20220105175115.605074-1-jannh@xxxxxxxxxx Signed-off-by: Jann Horn <jannh@xxxxxxxxxx> Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/oom_kill.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/mm/oom_kill.c~mm-oom-oom-sysrq-should-always-kill-a-process +++ a/mm/oom_kill.c @@ -1052,13 +1052,14 @@ EXPORT_SYMBOL_GPL(unregister_oom_notifie bool out_of_memory(struct oom_control *oc) { unsigned long freed = 0; + bool sysrq_forced = oc->order == -1; if (oom_killer_disabled) return false; if (!is_memcg_oom(oc)) { blocking_notifier_call_chain(&oom_notify_list, 0, &freed); - if (freed > 0) + if (freed > 0 && !sysrq_forced) /* Got some memory back in the last second. */ return true; } _ Patches currently in -mm which might be from jannh@xxxxxxxxxx are mm-oom-oom-sysrq-should-always-kill-a-process.patch