Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754981AbdGKABF (ORCPT ); Mon, 10 Jul 2017 20:01:05 -0400 Received: from mail-pg0-f43.google.com ([74.125.83.43]:35117 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754832AbdGKABE (ORCPT ); Mon, 10 Jul 2017 20:01:04 -0400 Date: Mon, 10 Jul 2017 17:01:01 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Tetsuo Handa cc: mhocko@kernel.org, linux-mm@kvack.org, oleg@redhat.com, andrea@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, mhocko@suse.com Subject: Re: [RFC PATCH] mm, oom: allow oom reaper to race with exit_mmap In-Reply-To: <201706271952.FEB21375.SFJFHOQLOtVOMF@I-love.SAKURA.ne.jp> Message-ID: References: <20170626130346.26314-1-mhocko@kernel.org> <201706271952.FEB21375.SFJFHOQLOtVOMF@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 Content-Length: 978 Lines: 17 On Tue, 27 Jun 2017, Tetsuo Handa wrote: > I wonder why you prefer timeout based approach. Your patch will after all > set MMF_OOM_SKIP if operations between down_write() and up_write() took > more than one second. lock_anon_vma_root() from unlink_anon_vmas() from > free_pgtables() for example calls down_write()/up_write(). unlink_file_vma() > from free_pgtables() for another example calls down_write()/up_write(). > This means that it might happen that exit_mmap() takes more than one second > with mm->mmap_sem held for write, doesn't this? > I certainly have no objection to increasing the timeout period or increasing MAX_OOM_REAP_RETRIES to be substantially higher. All threads holding mm->mmap_sem should be oom killed and be able to access memory reserves to make forward progress if they fail to reclaim. If we are truly blocked on mm->mmap_sem, waiting longer than one second to declare that seems justifiable to prevent the exact situation you describe.