From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751596AbcGMXxl (ORCPT ); Wed, 13 Jul 2016 19:53:41 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:34410 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbcGMXxe (ORCPT ); Wed, 13 Jul 2016 19:53:34 -0400 Date: Wed, 13 Jul 2016 16:53:28 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Mikulas Patocka cc: Michal Hocko , Tetsuo Handa , Ondrej Kozina , Jerome Marchand , Stanislav Kozina , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: System freezes after OOM In-Reply-To: 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> <20160713133955.GK28723@dhcp22.suse.cz> <20160713145638.GM28723@dhcp22.suse.cz> 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, Mikulas Patocka wrote: > What are the real problems that f9054c70d28bc214b2857cf8db8269f4f45a5e23 > tries to fix? > It prevents the whole system from livelocking due to an oom killed process stalling forever waiting for mempool_alloc() to return. No other threads may be oom killed while waiting for it to exit. > Do you have a stacktrace where it deadlocked, or was just a theoretical > consideration? > schedule schedule_timeout io_schedule_timeout mempool_alloc __split_and_process_bio dm_request generic_make_request submit_bio mpage_readpages ext4_readpages __do_page_cache_readahead ra_submit filemap_fault handle_mm_fault __do_page_fault do_page_fault page_fault > Mempool users generally (except for some flawed cases like fs_bio_set) do > not require memory to proceed. So if you just loop in mempool_alloc, the > processes that exhasted the mempool reserve will eventually return objects > to the mempool and you should proceed. > That's obviously not the case if we have hundreds of machines timing out after two hours waiting for that fault to succeed. The mempool interface cannot require that users return elements to the pool synchronous with all allocators so that we can happily loop forever, the only requirement on the interface is that mempool_alloc() must succeed. If the context of the thread doing mempool_alloc() allows access to memory reserves, this will always be allowed by the page allocator. This is not a mempool problem.