The patch titled Subject: mm/oom_kill.c: syzbot: dump all threads upon global OOM has been added to the -mm tree. Its filename is syzbot-dump-all-threads-upon-global-oom.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/syzbot-dump-all-threads-upon-global-oom.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/syzbot-dump-all-threads-upon-global-oom.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: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Subject: mm/oom_kill.c: syzbot: dump all threads upon global OOM syzbot is getting stalls with linux-next kernels because dump_tasks() from out_of_memory() is printing 5600 tasks. Most of these tasks are syzbot processes but syzbot is supposed not to create so many processes. Therefore, let's start from checking what these tasks are doing. This change will be removed after the bug is fixed. Link: http://lkml.kernel.org/r/312c642d-559b-92c7-0377-d98ec416e0bd@xxxxxxxxxxxxxxxxxxx Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/oom_kill.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/mm/oom_kill.c~syzbot-dump-all-threads-upon-global-oom +++ a/mm/oom_kill.c @@ -41,6 +41,7 @@ #include <linux/kthread.h> #include <linux/init.h> #include <linux/mmu_notifier.h> +#include <linux/sched/debug.h> #include <asm/tlb.h> #include "internal.h" @@ -446,6 +447,24 @@ static void dump_header(struct oom_contr if (is_dump_unreclaim_slabs()) dump_unreclaimable_slab(); } +#ifdef CONFIG_DEBUG_AID_FOR_SYZBOT + if (!is_sysrq_oom(oc) && !is_memcg_oom(oc)) { + struct task_struct *p; + unsigned int tasks = 0; + + rcu_read_lock(); + for_each_process(p) { + if (!(p->flags & PF_KTHREAD)) + tasks++; + } + rcu_read_unlock(); + + if (tasks >= 1000) { + show_state(); + panic("Out of memory with too many tasks."); + } + } +#endif if (sysctl_oom_dump_tasks) dump_tasks(oc->memcg, oc->nodemask); } _ Patches currently in -mm which might be from penguin-kernel@xxxxxxxxxxxxxxxxxxx are syzbot-dump-all-threads-upon-global-oom.patch