From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 4D7596B0010 for ; Thu, 9 Aug 2018 11:07:46 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id r21-v6so2123032edp.23 for ; Thu, 09 Aug 2018 08:07:46 -0700 (PDT) Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id c4-v6si3537544edb.348.2018.08.09.08.07.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 08:07:42 -0700 (PDT) Date: Thu, 9 Aug 2018 17:07:35 +0200 From: Michal Hocko Subject: Re: WARNING in try_charge Message-ID: <20180809150735.GA15611@dhcp22.suse.cz> References: <0000000000005e979605729c1564@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Tetsuo Handa Cc: Vladimir Davydov , Oleg Nesterov , David Rientjes , syzbot , cgroups@vger.kernel.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, syzkaller-bugs@googlegroups.com, Andrew Morton On Thu 09-08-18 22:57:43, Tetsuo Handa wrote: > >From b1f38168f14397c7af9c122cd8207663d96e02ec Mon Sep 17 00:00:00 2001 > From: Tetsuo Handa > Date: Thu, 9 Aug 2018 22:49:40 +0900 > Subject: [PATCH] mm, oom: task_will_free_mem(current) should retry until > memory reserve fails > > Commit 696453e66630ad45 ("mm, oom: task_will_free_mem should skip > oom_reaped tasks") changed to select next OOM victim as soon as > MMF_OOM_SKIP is set. But we don't need to select next OOM victim as > long as ALLOC_OOM allocation can succeed. And syzbot is hitting WARN(1) > caused by this race window [1]. It is not because the syzbot was exercising a completely different code path (memcg charge rather than the page allocator). > Since memcg OOM case uses forced charge if current thread is killed, > out_of_memory() can return true without selecting next OOM victim. > Therefore, this patch changes task_will_free_mem(current) to ignore > MMF_OOM_SKIP unless ALLOC_OOM allocation failed. And the patch is simply wrong for memcg. -- Michal Hocko SUSE Labs