From patchwork Fri Sep 7 13:21:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 10592213 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39DD55A4 for ; Fri, 7 Sep 2018 13:21:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E2972B2CB for ; Fri, 7 Sep 2018 13:21:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 209512B2DB; Fri, 7 Sep 2018 13:21:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72F5E2B2CB for ; Fri, 7 Sep 2018 13:21:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4AC196B7E82; Fri, 7 Sep 2018 09:21:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 45B946B7E83; Fri, 7 Sep 2018 09:21:24 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 372B76B7E84; Fri, 7 Sep 2018 09:21:24 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it0-f72.google.com (mail-it0-f72.google.com [209.85.214.72]) by kanga.kvack.org (Postfix) with ESMTP id 0E4176B7E82 for ; Fri, 7 Sep 2018 09:21:24 -0400 (EDT) Received: by mail-it0-f72.google.com with SMTP id h5-v6so20475123itb.3 for ; Fri, 07 Sep 2018 06:21:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:to:cc :references:from:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Np5av4Dzsy4CFsTyjsBRuHIalSbln6Y7IaO2dLoJB34=; b=VLyzvUgvTqDzu68W8EwoFNC+MMTZr/NiwgFguJksGZTnZtP7I7VbKTdLLQhHYk8wII E6+eYagVASPzaZZg55krAHgLa1QOqgwwrCXbf5G6JRXOR4LmZrbBRFI9sZEztqmhKtaT mQ6ffyYKmPsjMkJRAotqDK9r6cDtC2jv1dBxcNIhejVtsZ9z/S36oquiMmaoHxJCSJfB KjXAPd4oUz0/ZjLx1ZnAZRWSg7bgLKFjWdMLrtuziC+92HgaSXcFReW/6Bc+rDstnZcI dlcubcGmBT8MXvL6CfGWh14KUocVGFHvmzqHSCtIBvmQmaG3FITy12v7D4eLC88zDiyG HJtw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp X-Gm-Message-State: APzg51AAfw84rpy+3s+xPL6B7ET//MbA0QvYbCm9klNt+VWIWmGHvOyG yvP8HlBMpXnBc3qdNZazq5yx7RnAEH3Lg64GGCYI53S9Nn8bJv/69GEnF2To5vVD7QVjI3LBbzu YYYN92sieyzwQJpRYKOK/3vNjSs1DCIKbtJQu6SjZ3ZLdeQus4oOvKbyL57T2NPqrtg== X-Received: by 2002:a6b:4515:: with SMTP id s21-v6mr5727189ioa.273.1536326483778; Fri, 07 Sep 2018 06:21:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaazONyw1z9jX5VMEYGszmHUxmipG231I1qxxzzWdIyPmf/TGoRxA3mRVYLMN/uZKFbiU+a X-Received: by 2002:a6b:4515:: with SMTP id s21-v6mr5727129ioa.273.1536326482951; Fri, 07 Sep 2018 06:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536326482; cv=none; d=google.com; s=arc-20160816; b=ekqM9EtqyhyQGz0f8XfSeoUcoiLEj+xbqtdisVZgKHOdl8HyrA+iU5yii3QpVyi5wA 8PteHIRW5S4+xZQ0U3DOVgQ0Qg3IT+R/izn8C80ApLUMAAMw2EjiT62RQ942f+PmL741 JD17FjO+JTIIfSxIEAEfmArcP92BtVlNPXLtZI7J/NvT/eZbtyoy8h3D20ceWckUIQpJ C+zQvqiWk5pfsmscWcgefOPaamzkVoYjz5/dKchR3qn3eQDc2e94smJDk5gLInYazWbB gU20wx5MpMxSiDyRc7M+kWZ9/cEudU9KwVfAVll17Bct+NJxgyOwVbNdkBUwmiWxZegj ljdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject; bh=Np5av4Dzsy4CFsTyjsBRuHIalSbln6Y7IaO2dLoJB34=; b=cM/TNl560z743TRyBThCe4oN7amzpjUqU9NrHPWvR1YwZ0KXZM5GrCHs9rtzRjOJ8x sQqXKdxsjhaK5ofyEG8w/ef8JTh7bhV9Q28sGz5U5FOzlV1HPsjF/LGYljMnUqVSqY9t 6A6uAaPhqYnJET813PiIj/T8CHXMRnTrjy2w+NG2lSzvBO1kZO+gfEhWj15DsTl8gmAI 0nHvBqVuamHj/gz4I4BzqQDbf5cHDxfItUNShbIX6phcAU0FH2ONvpRMJpflaj02EQnW vibVWgeyxMmKVnLhWVYqaLtVY4RCkcp+Nogem7h6IAeYQz/EfqByPVQytzG18OfiLnDt xXvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp Received: from www262.sakura.ne.jp (www262.sakura.ne.jp. [202.181.97.72]) by mx.google.com with ESMTPS id 68-v6si5717916itu.143.2018.09.07.06.21.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 06:21:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) client-ip=202.181.97.72; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp Received: from fsav305.sakura.ne.jp (fsav305.sakura.ne.jp [153.120.85.136]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w87DLDhd007794; Fri, 7 Sep 2018 22:21:13 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav305.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav305.sakura.ne.jp); Fri, 07 Sep 2018 22:21:13 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav305.sakura.ne.jp) Received: from [192.168.1.8] (softbank060157066051.bbtec.net [60.157.66.51]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w87DL8RW007766 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 7 Sep 2018 22:21:13 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: [PATCH v2] syzbot: Dump all threads upon global OOM. To: Dmitry Vyukov Cc: Andrew Morton , Linux-MM , Michal Hocko References: <1536319423-9344-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> From: Tetsuo Handa Message-ID: <312c642d-559b-92c7-0377-d98ec416e0bd@i-love.sakura.ne.jp> Date: Fri, 7 Sep 2018 22:21:06 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 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 Cc: Dmitry Vyukov Cc: Michal Hocko --- 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 #include #include +#include #include #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); }