From patchwork Tue May 29 08:16:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 10434521 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 1DD50601E9 for ; Tue, 29 May 2018 08:16:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DC26285B6 for ; Tue, 29 May 2018 08:16:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00E2B285D1; Tue, 29 May 2018 08:16:46 +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 0DD63285B6 for ; Tue, 29 May 2018 08:16:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C7EB6B0003; Tue, 29 May 2018 04:16:43 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5795A6B0006; Tue, 29 May 2018 04:16:43 -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 48F596B0007; Tue, 29 May 2018 04:16:43 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) by kanga.kvack.org (Postfix) with ESMTP id DFA956B0003 for ; Tue, 29 May 2018 04:16:42 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id 142-v6so10586977wmt.1 for ; Tue, 29 May 2018 01:16:42 -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:date:from:to :cc:subject:message-id:references:mime-version:content-disposition :in-reply-to:user-agent; bh=QatrfIi5OT3YAaqPvixThz0WTBtfvlf19TLv7RX8C+4=; b=ihJTBOqIHyxmbQubbYRpf1n2+VlItr/HvYhBzU02ERvzwB06FeiieilJAQnZ8+Ex2Q c2Nxoj7YA/tYQJqlMcw+lGpAQixFKqUcDzJE+o6NaXEZhdCfPbuFEVVSYejphd+pszv4 tsupTS0yFpkegn8wrJJVcG/0ChsfYqlVjZ6TgLuvp4XsVKdv8/ODkyPpNaiPKSrUyVeL WYdGl2jgU1CaVh2jGOCor2Iv8kr8CpZi/wYp7wLFoles+dabnJnn9BRTCSX8Y8JDZH/X TuPBJqA4R3DFWhrMv5MZu3pYlnI2A2TIlgXKoRaVqKemtKdnN+1Z4m6Ob/PfIlm79rqH BdWg== X-Original-Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning mhocko@kernel.org does not designate 195.135.220.15 as permitted sender) smtp.mailfrom=mhocko@kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Gm-Message-State: ALKqPweFbuHhJ7xKoZ/uLMKb9hIeMJgDs9Nkb/NnFQVvHRkAXMt7Bqej 1Qkj9tJ8vrFH/9OnK6vjzvxUT+gFmHAEoGM9b1UHwhECFyVcP4Fdb7E3ujMly54MjVLOTP51Xbt Au45mIigwWCGIv9CGYj0f4+OtWvJDQX7kx5pSR76OnHRQ4xUdcnu8uznHvmKNVtg= X-Received: by 2002:a50:d7d7:: with SMTP id m23-v6mr18033965edj.19.1527581802293; Tue, 29 May 2018 01:16:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoVv5l7OXdb0jPnEfuF4c5hqkZBd9B5exLoXTtyU8UREkd7bcmALKSfnkJfL1acf47YWHJd X-Received: by 2002:a50:d7d7:: with SMTP id m23-v6mr18033910edj.19.1527581801431; Tue, 29 May 2018 01:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527581801; cv=none; d=google.com; s=arc-20160816; b=KpzjJpPtUNbOvQMXV1sVhuC/4ulKHT8qnhcBlY11NWbDnnxq5DMHsAaMCZbaPJls2E QaVw/8dLbQAu6qE6cbwdZvqJLSvZQKM4FGNuUQiuZrq/CqhaIqoxyReOW1NQW25ts86L 57YytJ8O6Q4id/ERAC+Pu1HYmqwCLt2TTXCmyfVeTEdaqL0WO30tDmQTIXYBSG77gVaf bTVGm9FUypq/Xh84rUIVq5pDnymzD2o8fxhuVrT5ptWcRIGx3DGmVVNawDm1XwuQh66Y 4TjT9OOA+WUKDluUSIpqXBSGs5hexz1ddwKPLxYRzAPUWfpgQlKZLJMOrqFSqxxFYEh5 YwRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:arc-authentication-results; bh=QatrfIi5OT3YAaqPvixThz0WTBtfvlf19TLv7RX8C+4=; b=prEYtrChaLgULXa53Bi/xKtwG5Y90VIRVlmRnbZbr47FeutHLSQvzpCpsLUq9RnJ+A i93XtbSKqdY4TUstzvNF3Y6ulDPO9EFjC4esRon0dnnlig2ywudbgZX/W7+m5wJEZ1Ol JLQE7xnIQIBlhFxxStapZkwYSlw4qGgw0s1H6msM/a3TskQ+eyj+/mU/0G6d75sKBUEO dcerJcy8QEDEKQ2MlqdALpk8Vlf/6Ct7io0iEGmJqKcmofhRQvo036ZLIvDF2aiiweUr 6PwcXPurhzGquxDXH2Jm4fZLwVunnChwUKvW7gAzoQs7naLr2vBpFi+f8vMhUVajAJvP 4ePA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning mhocko@kernel.org does not designate 195.135.220.15 as permitted sender) smtp.mailfrom=mhocko@kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from mx2.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id t12-v6si2749860edi.195.2018.05.29.01.16.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 29 May 2018 01:16:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning mhocko@kernel.org does not designate 195.135.220.15 as permitted sender) client-ip=195.135.220.15; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning mhocko@kernel.org does not designate 195.135.220.15 as permitted sender) smtp.mailfrom=mhocko@kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AEF88AF80; Tue, 29 May 2018 08:16:40 +0000 (UTC) Date: Tue, 29 May 2018 10:16:39 +0200 From: Michal Hocko To: guro@fb.com, Tetsuo Handa Cc: rientjes@google.com, hannes@cmpxchg.org, vdavydov.dev@gmail.com, tj@kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, torvalds@linux-foundation.org Subject: Re: [PATCH] mm,oom: Don't call schedule_timeout_killable() with oom_lock held. Message-ID: <20180529081639.GM27180@dhcp22.suse.cz> References: <20180515091655.GD12670@dhcp22.suse.cz> <201805181914.IFF18202.FOJOVSOtLFMFHQ@I-love.SAKURA.ne.jp> <20180518122045.GG21711@dhcp22.suse.cz> <201805210056.IEC51073.VSFFHFOOQtJMOL@I-love.SAKURA.ne.jp> <20180522061850.GB20020@dhcp22.suse.cz> <201805231924.EED86916.FSQJMtHOLVOFOF@I-love.SAKURA.ne.jp> <20180529071736.GI27180@dhcp22.suse.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180529071736.GI27180@dhcp22.suse.cz> User-Agent: Mutt/1.9.5 (2018-04-13) 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 With the full changelog. This can be either folded into the respective patch or applied on top. From 0bd619e7a68337c97bdaed288e813e96a14ba339 Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Tue, 29 May 2018 10:09:33 +0200 Subject: [PATCH] mm, memcg, oom: fix pre-mature allocation failures Tetsuo has noticed that "mm, oom: cgroup-aware OOM killer" can lead to a pre-mature allocation failure if the cgroup aware oom killer is enabled and select_victim_memcg doesn't pick up any memcg to kill because there is a memcg already being killed. oc->chosen_memcg will become INFLIGHT_VICTIM and oom_kill_memcg_victim will bail out early. oc->chosen_task will stay NULL, however, and out_of_memory will therefore return false which forces __alloc_pages_may_oom to not set did_some_progress and the page allocator backs out and fails the allocation. U Fix this by checking both chosen_task and chosen_memcg in out_of_memory and return false only when _both_ are NULL. Fixes: "mm, oom: cgroup-aware OOM killer" Reported-by: Tetsuo Handa Signed-off-by: Michal Hocko --- mm/oom_kill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 565e7da55318..fc06af041447 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1174,7 +1174,7 @@ bool out_of_memory(struct oom_control *oc) if (delay) schedule_timeout_killable(1); - return !!oc->chosen_task; + return !!(oc->chosen_task | oc->chosen_memcg); } /*