Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp791665imm; Wed, 8 Aug 2018 05:58:19 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxKFhlqea5axX4z6YFquDoG4OzRmw7+zUmC7BhjC1W8Q+mDH967UKIm7xm2gMmOPfwPqiTy X-Received: by 2002:a63:a042:: with SMTP id u2-v6mr2476653pgn.80.1533733099879; Wed, 08 Aug 2018 05:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533733099; cv=none; d=google.com; s=arc-20160816; b=N7SaN0Olp9dlJgnOs/zNHz2agWfscYuwj4Jl/f4aJPhJ8/S8axeMxZwYfIQ84HibYu SCyQM8Uljd92o5xRUFhBa40QyeHwP33pelADe5FI7PesQZIL2JZP3c0TnsGSMA3+QEgV vZnByDbdSUP5Hz9jgfjgaVks9UdEBpgDMfs3PIJZzByLlI05qWAKB7Nt2W8pyQy65z8Z kmkDYtoyOsYZBKfRiPNjWB3f6KwWF6SproI6r08XtQLG/r5ZbxBFTVdk6nPH5zEJsqtb RSJ4ycZpCIWkdv+y02yiBXQgvqYWQ65D1Wjv/s63ShtzXnc/0sdTro4MNva3VxBPxlQg N0RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:arc-authentication-results; bh=AuntbX/2nbrFzB7jZ1QrN1O7vc3jlBJu8IhwIaSYQyg=; b=Mqvic6RtEoNzgotH3L9zLVmpSjQ124bdLl+QMJr7jM4M408pbWRFBTBrCw8g23fk6X alJRGy9s5sAk80w8V1q1kODPkSmRXQG41NDbzsH39GUoCytWsUsMk4avqKlKzrWW+Qbc yOuxVKjYNzvJuOZ8NitVDyLHe3j4UenAwHzWvfYvPmxlhVxdDVitP83X50mEeu7dH60y wt/8IBWF12juqDVGZSlL7+QGPnqt0jasDreKNc3/YHECDtJAoCTr+Z6/RPUxpMUbZWTM XCrC9VEo7eOGfhcUlthK0/Pcvtqis2RyMrm42e1IXI93478uSjbro3PC/x33A/PrLAxI 3T8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11-v6si4074098pgb.102.2018.08.08.05.58.04; Wed, 08 Aug 2018 05:58:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727102AbeHHPQu (ORCPT + 99 others); Wed, 8 Aug 2018 11:16:50 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:22664 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726680AbeHHPQt (ORCPT ); Wed, 8 Aug 2018 11:16:49 -0400 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 w78CvDvW040811; Wed, 8 Aug 2018 21:57:13 +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); Wed, 08 Aug 2018 21:57:13 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav302.sakura.ne.jp) Received: from [192.168.1.8] (softbank126074194044.bbtec.net [126.74.194.44]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w78CvDxj040808 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Aug 2018 21:57:13 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH] memcg, oom: be careful about races when warning about no reclaimable task From: Tetsuo Handa To: Johannes Weiner Cc: Michal Hocko , Andrew Morton , Vladimir Davydov , linux-mm@kvack.org, Greg Thelen , Dmitry Vyukov , LKML , Michal Hocko , David Rientjes References: <20180807072553.14941-1-mhocko@kernel.org> <863d73ce-fae9-c117-e361-12c415c787de@i-love.sakura.ne.jp> <20180807201935.GB4251@cmpxchg.org> <1308e0bd-e194-7b35-484c-fc18f493f8da@i-love.sakura.ne.jp> Message-ID: <9cea37c8-ab90-2fdf-395c-efe52ff07072@i-love.sakura.ne.jp> Date: Wed, 8 Aug 2018 21:57:13 +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: <1308e0bd-e194-7b35-484c-fc18f493f8da@i-love.sakura.ne.jp> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/08/08 5:38, Tetsuo Handa wrote: > On 2018/08/08 5:19, Johannes Weiner wrote: >> On Tue, Aug 07, 2018 at 07:15:11PM +0900, Tetsuo Handa wrote: >>> On 2018/08/07 16:25, Michal Hocko wrote: >>>> @@ -1703,7 +1703,8 @@ static enum oom_status mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int >>>> return OOM_ASYNC; >>>> } >>>> >>>> - if (mem_cgroup_out_of_memory(memcg, mask, order)) >>>> + if (mem_cgroup_out_of_memory(memcg, mask, order) || >>>> + tsk_is_oom_victim(current)) >>>> return OOM_SUCCESS; >>>> >>>> WARN(1,"Memory cgroup charge failed because of no reclaimable memory! " >>>> >>> >>> I don't think this patch is appropriate. This patch only avoids hitting WARN(1). >>> This patch does not address the root cause: >>> >>> The task_will_free_mem(current) test in out_of_memory() is returning false >>> because test_bit(MMF_OOM_SKIP, &mm->flags) test in task_will_free_mem() is >>> returning false because MMF_OOM_SKIP was already set by the OOM reaper. The OOM >>> killer does not need to start selecting next OOM victim until "current thread >>> completes __mmput()" or "it fails to complete __mmput() within reasonable >>> period". >> >> I don't see why it matters whether the OOM victim exits or not, unless >> you count the memory consumed by struct task_struct. > > We are not counting memory consumed by struct task_struct. But David is > counting memory released between set_bit(MMF_OOM_SKIP, &mm->flags) and > completion of exit_mmap(). Also, before the OOM reaper was introduced, we waited until TIF_MEMDIE is cleared from the OOM victim thread. Compared to pre OOM reaper era, giving up so early is certainly a regression.