From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by kanga.kvack.org (Postfix) with ESMTP id CA5C06B0005 for ; Fri, 11 Mar 2016 06:32:58 -0500 (EST) Received: by mail-wm0-f50.google.com with SMTP id l68so14554938wml.0 for ; Fri, 11 Mar 2016 03:32:58 -0800 (PST) Subject: Re: [PATCH 11/18] coredump: make coredump_wait wait for mma_sem for write killable References: <1456752417-9626-1-git-send-email-mhocko@kernel.org> <1456752417-9626-12-git-send-email-mhocko@kernel.org> From: Vlastimil Babka Message-ID: <56E2ACE7.50008@suse.cz> Date: Fri, 11 Mar 2016 12:32:55 +0100 MIME-Version: 1.0 In-Reply-To: <1456752417-9626-12-git-send-email-mhocko@kernel.org> Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko , LKML Cc: Andrew Morton , linux-mm@kvack.org, Alex Deucher , Alex Thorlton , Andrea Arcangeli , Andy Lutomirski , Benjamin LaHaise , =?UTF-8?Q?Christian_K=c3=b6nig?= , Daniel Vetter , Dave Hansen , David Airlie , Davidlohr Bueso , David Rientjes , "H . Peter Anvin" , Hugh Dickins , Ingo Molnar , Johannes Weiner , "Kirill A . Shutemov" , Konstantin Khlebnikov , linux-arch@vger.kernel.org, Mel Gorman , Oleg Nesterov , Peter Zijlstra , Petr Cermak , Thomas Gleixner , Michal Hocko On 02/29/2016 02:26 PM, Michal Hocko wrote: > From: Michal Hocko > > coredump_wait waits for mmap_sem for write currently which can > prevent oom_reaper to reclaim the oom victims address space > asynchronously because that requires mmap_sem for read. This might > happen if the oom victim is multi threaded and some thread(s) is > holding mmap_sem for read (e.g. page fault) and it is stuck in > the page allocator while other thread(s) reached coredump_wait > already. > > This patch simply uses down_write_killable and bails out with EINTR > if the lock got interrupted by the fatal signal. do_coredump will > return right away and do_group_exit will take care to zap the whole > thread group. > > Cc: Oleg Nesterov > Signed-off-by: Michal Hocko Acked-by: Vlastimil Babka > --- > fs/coredump.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/coredump.c b/fs/coredump.c > index 9ea87e9fdccf..6b8aa1629891 100644 > --- a/fs/coredump.c > +++ b/fs/coredump.c > @@ -410,7 +410,9 @@ static int coredump_wait(int exit_code, struct core_state *core_state) > core_state->dumper.task = tsk; > core_state->dumper.next = NULL; > > - down_write(&mm->mmap_sem); > + if (down_write_killable(&mm->mmap_sem)) > + return -EINTR; > + > if (!mm->core_state) > core_waiters = zap_threads(tsk, mm, core_state, exit_code); > up_write(&mm->mmap_sem); > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org