From patchwork Thu Jun 7 11:00:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 10451659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53DFE6037F for ; Thu, 7 Jun 2018 11:01:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4419929BF3 for ; Thu, 7 Jun 2018 11:01:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3729F29C3A; Thu, 7 Jun 2018 11:01:23 +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 459F829BF3 for ; Thu, 7 Jun 2018 11:01:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B2AA6B0008; Thu, 7 Jun 2018 07:01:21 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 68A3D6B000A; Thu, 7 Jun 2018 07:01:21 -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 578286B000C; Thu, 7 Jun 2018 07:01:21 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io0-f200.google.com (mail-io0-f200.google.com [209.85.223.200]) by kanga.kvack.org (Postfix) with ESMTP id 2CBA46B0008 for ; Thu, 7 Jun 2018 07:01:21 -0400 (EDT) Received: by mail-io0-f200.google.com with SMTP id i1-v6so7158944ioh.15 for ; Thu, 07 Jun 2018 04:01:21 -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:from:to:cc :subject:date:message-id:in-reply-to:references; bh=4007QhtNj7le153sIDXv3Qvbe53EI2FTqC03pULGH7M=; b=KMi9lAI5o4XYzAGoVKTTT46Sb5uqjVREBNScggzNGb9JaTbPXb3q1mnLBPUp2g2mri 8e5qpeVT0WWBWV+qclNl9wBlSeElkDDaq6IWtpi844kytTbdNSwQaolRLihJqCbNuSV9 WuFnhZ3G0GPhhQrDpdUcTDl3nRBJ/Riy+ubsIO+AbqE/cD6ZLOGc33sSN7Gn8OKqSk1H 9YwsWDSoTuyurnmFohhOloXRoKw1XiN2GY5cQIi8G+zzLRlxptWik4nv6hm0kIbOdAU5 evDs0jRps+r4lVm/JROzsVCADUllpgg1VGA4isvEFZkEDnL9ZaHgOqCbWNbc4405k3RY vXQA== 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: APt69E1lbvoyHYl8cU9ygttQHhE56E3O+IHgvpjAycjapIQebLlaLRyO x96qiYlD9DVa2OgEGrBTNwira1Hmj/pd64mGTEtipoZSuDpIfPeZfx3VXjgmmMHBcmUx3/jt+3n v+2WU1B++PTVdr+PI/QEvhKWKZ9fzwqyjr0CYkjk19OT5FmzmbxwN0GGTtTtqiu0D8A== X-Received: by 2002:a24:8602:: with SMTP id u2-v6mr1326086itd.23.1528369280970; Thu, 07 Jun 2018 04:01:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLJ4mrB61usZ52mckcy4zRrr8uT4Ec0All23/wygCoTJtcUQPcGUgUlrsvtvNscJhImyWSR X-Received: by 2002:a24:8602:: with SMTP id u2-v6mr1326017itd.23.1528369280162; Thu, 07 Jun 2018 04:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528369280; cv=none; d=google.com; s=arc-20160816; b=SxccGSFmfmWrmywdU5J7WjZRIZy9WUZIShxzGVbaJA7hZTOA/cIkQ8JPOFt7njnUJS cEMMujzbIkf2rFVDT8zylTp1Z6HqNx+4zNSXPGdxV9nnS404eHMbSAsBCtXkKfCRrOpg AG1ahtJ8BJ1rZAJ4/C7CQySu1dl701ofB+VPOywlBBUhraOBlCNbDZyC2cXcvJZRKzI5 whWAtPwfEXBwyDUPmYz5n+E2nfKh/TbSg405hdtdCWPpXbCbJ7IpLzRAdrcdR1miNrNv /MqRe/QW4/W3SZQzVmwW3bT5MHq+DcZ6vk1UZ4mGrgzxDGvW0tlvV7wuwEAsugqF5uXl R1kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=4007QhtNj7le153sIDXv3Qvbe53EI2FTqC03pULGH7M=; b=aTKAKX6p/4a4fw4Y00lpXl74XLndLhKxDif5vHc7sQ0SSE1ZM/eH9QEWYYBguL5KB5 vwlAO8bNtK8HKpv67+G18wdY53//4UuMC/gB6KI3C8a7aFPvNLszVqVbRM9XGB3usKAk scNZoaDRB/XFYdCBDSmXJpgPhTVlyxrKz211cVUsoSaQarJYlkHR2556Rznvj4msqCnB bX60qnOI1T/F2CB2YnVw58fKfbmflAUAsBgIOgeIhQyzcu+bC23rQx4zvAmwkSx/D6vY oEWrv1fZ5Wyt4xbmSNSkgd/OwMfrTZlNLbJxrs2PUKjVv4zdXxN0BYLDwsB9A/W/rJej 38Rg== 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 n75-v6si6581992ion.86.2018.06.07.04.01.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 04:01:20 -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 fsav302.sakura.ne.jp (fsav302.sakura.ne.jp [153.120.85.133]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w57B0Ueh033497; Thu, 7 Jun 2018 20:00:31 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav302.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav302.sakura.ne.jp); Thu, 07 Jun 2018 20:00:30 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav302.sakura.ne.jp) Received: from ccsecurity.localdomain (softbank126074194044.bbtec.net [126.74.194.44]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w57B0OP9033466 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 7 Jun 2018 20:00:30 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) From: Tetsuo Handa To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, Tetsuo Handa , David Rientjes , Johannes Weiner , Michal Hocko , Roman Gushchin , Tejun Heo , Vladimir Davydov Subject: [PATCH 3/4] mm, oom: Simplify exception case handling in out_of_memory(). Date: Thu, 7 Jun 2018 20:00:22 +0900 Message-Id: <1528369223-7571-3-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1528369223-7571-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> References: <1528369223-7571-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> 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 To avoid oversights when adding the "mm, oom: cgroup-aware OOM killer" patchset, simplify the exception case handling in out_of_memory(). This patch makes no functional changes. Signed-off-by: Tetsuo Handa Cc: Roman Gushchin Cc: Michal Hocko Cc: Johannes Weiner Cc: Vladimir Davydov Cc: David Rientjes Cc: Tejun Heo Acked-by: Michal Hocko Acked-by: David Rientjes --- mm/oom_kill.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 23ce67f..5a6f1b1 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1073,15 +1073,18 @@ bool out_of_memory(struct oom_control *oc) } select_bad_process(oc); + if (oc->chosen == (void *)-1UL) + return true; /* Found nothing?!?! Either we hang forever, or we panic. */ - if (!oc->chosen && !is_sysrq_oom(oc) && !is_memcg_oom(oc)) { + if (!oc->chosen) { + if (is_sysrq_oom(oc) || is_memcg_oom(oc)) + return false; dump_header(oc, NULL); panic("Out of memory and no killable processes...\n"); } - if (oc->chosen && oc->chosen != (void *)-1UL) - oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" : - "Memory cgroup out of memory"); - return !!oc->chosen; + oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" : + "Memory cgroup out of memory"); + return true; } /*