On 2018/09/07 21:57, Dmitry Vyukov wrote: >> @@ -446,6 +447,10 @@ static void dump_header(struct oom_control *oc, struct task_struct *p) >> if (is_dump_unreclaim_slabs()) >> dump_unreclaimable_slab(); >> } >> +#ifdef CONFIG_DEBUG_AID_FOR_SYZBOT >> + show_state(); >> + panic("Out of memory"); > > won't this panic on every oom? > we have lots of oom's, especially inside of cgroups, but probably global too > it would be bad if we crash all machines this way > > OK. Here is updated patch. >From f3bc8fe25f61d83033472470f950434adc686e20 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Date: Fri, 7 Sep 2018 22:18:23 +0900 Subject: [PATCH v2] 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. Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> --- mm/oom_kill.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index f10aa53..7130285 100644 --- a/mm/oom_kill.c +++ b/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_control *oc, struct task_struct *p) 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); } -- 1.8.3.1