From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95D61C433E1 for ; Mon, 20 Jul 2020 10:37:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 524FE22482 for ; Mon, 20 Jul 2020 10:37:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KNELH7S6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 524FE22482 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BAA576B0003; Mon, 20 Jul 2020 06:37:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B593A6B0005; Mon, 20 Jul 2020 06:37:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A71636B0006; Mon, 20 Jul 2020 06:37:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id 92CFD6B0003 for ; Mon, 20 Jul 2020 06:37:31 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 35EE88248047 for ; Mon, 20 Jul 2020 10:37:31 +0000 (UTC) X-FDA: 77058102702.03.step98_2a0975326f24 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 0A16C1AB9D for ; Mon, 20 Jul 2020 10:37:31 +0000 (UTC) X-HE-Tag: step98_2a0975326f24 X-Filterd-Recvd-Size: 4739 Received: from mail-il1-f194.google.com (mail-il1-f194.google.com [209.85.166.194]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jul 2020 10:37:30 +0000 (UTC) Received: by mail-il1-f194.google.com with SMTP id r12so12805059ilh.4 for ; Mon, 20 Jul 2020 03:37:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wDeXVEBl0ahvlqG23uGu/bmDs+SEuMU4mdlPMpRP2Lg=; b=KNELH7S6lWAGbGCs/M8gF1s/ALJvQy6duusyiFkruJHjEvUIMYs0HKJwO645XS/MvZ 0Vj7DXOWJZKkV+1YtRRhb0s+8ANV2K/wUaVghSB0sJp/05KojEe0+qAyzAGAqTPX1Y9P +DZz7hzapGlDL335Rrf/DS1Vg9XPr3zBklkfXIqNLoHFMVmd7/ZGWzBlgkQH06RTX0tA urgHsmdZWzYESKYuVKk04uO1UH0ZHK4a2QRp9Nm77QGK2ecOrGBiV7f29eP/c9iCT7f0 OdS3jarhqwKrR9rxBeAZKI3IFhP64apAaAq7hHhLnD5XsstYQLCmJvgatbdUDVPRN1Y0 8PSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wDeXVEBl0ahvlqG23uGu/bmDs+SEuMU4mdlPMpRP2Lg=; b=IcsPW+o2efyKz1uoDXq+iXndqSD0pe/+9r1EBQs7+sR8l8/M+3P1SvvQbXrJISOgsG 4NWJa9IIG5JQtDC1nrpmUjdk/ExLloUnm5jscH8i1MszrrH8Gr71Z/ecUzaZ4jpZLdaS 9kazj2KJHSVBjgdFC7pQOi+AsNlQnwXkZ1zv0PbEgNYtEPxUz4VLSGBClirqOKTrxfoU SLb7xhN3nYbL+Lsvq8fibSuu41PR7h6E37gfAYXsdiViwMpbs+O4ljndMYa5XbSc5lL3 covUcFBw0gooL98iD6jD9HYuvNCX6vwe84ZL5xxMVoF8gSTU2QbLQ/xHrRxCysL6H07q 2xkg== X-Gm-Message-State: AOAM531vsJzrTGzVSmIh/2lhExcj6i7uPi73XA74/TNCLoZdimW+zXIa 9OEpAVcHP/46ASi2rNyvHo7KuCmmyx++cojxNUY= X-Google-Smtp-Source: ABdhPJyBoFBy26pXXsYBcJo8zVXn6zAm1cxPrhOTBByKnf5PN8KwJDPx/Tp1xapZGH3krJkX9xA5agFo+WU03W41API= X-Received: by 2002:a92:1b8c:: with SMTP id f12mr8944896ill.93.1595241449936; Mon, 20 Jul 2020 03:37:29 -0700 (PDT) MIME-Version: 1.0 References: <1595166795-27587-1-git-send-email-laoar.shao@gmail.com> <20200720071607.GA18535@dhcp22.suse.cz> In-Reply-To: <20200720071607.GA18535@dhcp22.suse.cz> From: Yafang Shao Date: Mon, 20 Jul 2020 18:36:53 +0800 Message-ID: Subject: Re: [PATCH] mm, oom: show process exiting information in __oom_kill_process() To: Michal Hocko Cc: David Rientjes , Tetsuo Handa , Andrew Morton , Linux MM Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 0A16C1AB9D X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: On Mon, Jul 20, 2020 at 3:16 PM Michal Hocko wrote: > > On Sun 19-07-20 09:53:15, Yafang Shao wrote: > > When the OOM killer finding a victim and trying to kill it, if the victim > > is already exiting, the task mm will be NULL and no process will be killed. > > But the dump_header() has been already executed, so it will be strange to > > dump so many information without killing a process. We'd better show some > > helpful information to indicate why this happens. > > > > Suggested-by: David Rientjes > > Signed-off-by: Yafang Shao > > Cc: Michal Hocko > > Cc: Tetsuo Handa > > --- > > mm/oom_kill.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > > index 6e94962..0480dde 100644 > > --- a/mm/oom_kill.c > > +++ b/mm/oom_kill.c > > @@ -863,9 +863,13 @@ static void __oom_kill_process(struct task_struct *victim, const char *message) > > > > p = find_lock_task_mm(victim); > > if (!p) { > > + pr_info("Process %d (%s) is already exiting\n", > > + task_pid_nr(victim), victim->comm); > > put_task_struct(victim); > > I do agree that a silent bail out is not the best thing to do. The above > message would be more useful if it also explained what the oom killer > does (or does not): > > "OOM victim %d (%s) is already exiting. Skip killing the task\n" > Sure. > > return; > > - } else if (victim != p) { > > + } > > + > > + if (victim != p) { > > Why do we need this? > Because I don't like that code style. But it is not a big problem, I will not change it in the next version. > > get_task_struct(p); > > put_task_struct(victim); > > victim = p; > > -- > > 1.8.3.1 > > -- > Michal Hocko > SUSE Labs -- Thanks Yafang