From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751492AbcGNABu (ORCPT ); Wed, 13 Jul 2016 20:01:50 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:33543 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751342AbcGNABn (ORCPT ); Wed, 13 Jul 2016 20:01:43 -0400 Date: Wed, 13 Jul 2016 17:01:37 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Tetsuo Handa cc: Mikulas Patocka , Michal Hocko , Ondrej Kozina , Jerome Marchand , Stanislav Kozina , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: System freezes after OOM In-Reply-To: <2d5e1f84-e886-7b98-cb11-170d7104fd13@I-love.SAKURA.ne.jp> Message-ID: References: <57837CEE.1010609@redhat.com> <9be09452-de7f-d8be-fd5d-4a80d1cd1ba3@redhat.com> <20160712064905.GA14586@dhcp22.suse.cz> <2d5e1f84-e886-7b98-cb11-170d7104fd13@I-love.SAKURA.ne.jp> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 Jul 2016, Tetsuo Handa wrote: > I wonder whether commit f9054c70d28bc214 ("mm, mempool: only set > __GFP_NOMEMALLOC if there are free elements") is doing correct thing. > It says > > If an oom killed thread calls mempool_alloc(), it is possible that it'll > loop forever if there are no elements on the freelist since > __GFP_NOMEMALLOC prevents it from accessing needed memory reserves in > oom conditions. > > but we can allow mempool_alloc(__GFP_NOMEMALLOC) requests to access > memory reserves via below change, can't we? The purpose of allowing > ALLOC_NO_WATERMARKS via TIF_MEMDIE is to make sure current allocation > request does not to loop forever inside the page allocator, isn't it? This would defeat the purpose of __GFP_NOMEMALLOC for oom killed threads, so you'd need to demonstrate that isn't a problem for the current users and then change the semantics of the gfp flag. > Why we need to allow mempool_alloc(__GFP_NOMEMALLOC) requests to use > ALLOC_NO_WATERMARKS when TIF_MEMDIE is not set? > mempool_alloc(__GFP_NOMEMALLOC) is forbidden.