From patchwork Sun Jul 19 13:53:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 11672447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 06933618 for ; Sun, 19 Jul 2020 13:54:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C681F22B4E for ; Sun, 19 Jul 2020 13:54:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pRRYriyq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C681F22B4E 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 BA61F6B0003; Sun, 19 Jul 2020 09:54:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B568D6B0005; Sun, 19 Jul 2020 09:54:50 -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 A459A6B0006; Sun, 19 Jul 2020 09:54:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id 909986B0003 for ; Sun, 19 Jul 2020 09:54:50 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1B8A68248047 for ; Sun, 19 Jul 2020 13:54:50 +0000 (UTC) X-FDA: 77054971140.28.tramp44_0115cf826f1c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id F1EEC1CFB9 for ; Sun, 19 Jul 2020 13:53:54 +0000 (UTC) X-Spam-Summary: 1,0,0,f3877ac89ebb67b7,d41d8cd98f00b204,laoar.shao@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2693:2892:3138:3139:3140:3141:3142:3352:3865:3867:3868:3871:3872:4250:5007:6119:6261:6653:7514:7903:9413:10004:11026:11658:11914:12043:12048:12296:12297:12517:12519:12533:12555:12895:13069:13075:13095:13311:13357:14181:14384:14394:14687:14721:21080:21324:21433:21444:21451:21627:21666:21990:30054:30056:30075,0,RBL:209.85.160.193:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100;04yfdsx8doppsmb5o5dsu59t6xgwiypgxwzwepagr9n1346hzk87n4we1o3jgo8.u1ufzhn7xihkf4dismxqxzpt4hc8dao3yjopz4o8siuuomninhgkebkj6fp9obt.w-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: tramp44_0115cf826f1c X-Filterd-Recvd-Size: 3839 Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Sun, 19 Jul 2020 13:53:54 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id j10so11099162qtq.11 for ; Sun, 19 Jul 2020 06:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=DG415CqP2iXmrPa0Q24oOuT9RrskImY70xqyyjRGIew=; b=pRRYriyqHQWo/sdbY3yi9D+D4ZUK0AYFxzIV0bhGlCZLO4hFR5znWo5T6OL7BkHVVL LtqZUNaQ084aqXsgUB89xDFe6FrtZE2Wax25QbQdkgfEyef98e7+U+noomGullT798As sLywwelJyxavBC1+f+gzlxcjSJrov07hqn9aWfkoVj/kvhnkFgy2EJxwOForIuIhMkXG GWCQnqQvzt7VjdJOtwmBuO0xuVPnzv69pVyfFpG/Vdbd38ZHcOc7AL6xxbcVmmWkr5My p+GmrStTxLzf7HovJwXLTWXA7N6Hv+/ZDArAO6B6326xjZI4P3mFJCtuB/L+KbdwOBmZ BDwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DG415CqP2iXmrPa0Q24oOuT9RrskImY70xqyyjRGIew=; b=VNsqxmXMT5FPj2GJpOCxLrTdJH9rqtWF/RzAi1dyqJipdqZypXEbFNgDFtaQXZOOeE M5D+xoUMTD7YIwApga44xdmzOrdTu6I5qK+F8WNzLhIvOps6HMPE/l5OE0yxjpyK8N9U Y4i88fKuMR02lTMP9Gen01POSZk5ixaHBrKlltFZnt9NBLfa91p0KZaVBMet7YlsIHyF lFyoPGEmZehJjqfNmRe1wIpChMOh6RrwzNmqvIC+sQ9Dg9HN0VLfAQ0PV81EAxoCWwPl dhVTvJcke2fcaE2QrqBHtaJc0X0UhrvGxpMwzr4hiaMG+Jts0h0zLLusoU27UtWzEEwq iIUw== X-Gm-Message-State: AOAM531qegucBcBYmuSRl5DySmaIHHNzQpHGsEa3SzS+6xdR1PH8pLZL QPnkk8+zuFvheKbvgQUG5SI= X-Google-Smtp-Source: ABdhPJxGB9OAdIYtoSlzvH4OKrp10lacvpAVc2hGXDRabcZ2O1PqlDGuJ9r58J5QTFrxHkGWdWCdKA== X-Received: by 2002:ac8:3777:: with SMTP id p52mr19152307qtb.31.1595166834063; Sun, 19 Jul 2020 06:53:54 -0700 (PDT) Received: from dev.localdomain ([183.134.211.54]) by smtp.gmail.com with ESMTPSA id p3sm16507537qtl.21.2020.07.19.06.53.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jul 2020 06:53:53 -0700 (PDT) From: Yafang Shao To: rientjes@google.com, mhocko@kernel.org, penguin-kernel@i-love.sakura.ne.jp, akpm@linux-foundation.org Cc: linux-mm@kvack.org, Yafang Shao Subject: [PATCH] mm, oom: show process exiting information in __oom_kill_process() Date: Sun, 19 Jul 2020 09:53:15 -0400 Message-Id: <1595166795-27587-1-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Rspamd-Queue-Id: F1EEC1CFB9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: 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); return; - } else if (victim != p) { + } + + if (victim != p) { get_task_struct(p); put_task_struct(victim); victim = p;