From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [PATCH 13/18] exec: make exec path waiting for mmap_sem killable Date: Mon, 29 Feb 2016 18:23:34 +0100 Message-ID: <20160229172333.GB3615@redhat.com> References: <1456752417-9626-1-git-send-email-mhocko@kernel.org> <1456752417-9626-14-git-send-email-mhocko@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46216 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750843AbcB2RXm (ORCPT ); Mon, 29 Feb 2016 12:23:42 -0500 Content-Disposition: inline In-Reply-To: <1456752417-9626-14-git-send-email-mhocko@kernel.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Michal Hocko Cc: LKML , Andrew Morton , linux-mm@kvack.org, Alex Deucher , Alex Thorlton , Andrea Arcangeli , Andy Lutomirski , Benjamin LaHaise , Christian =?iso-8859-1?Q?K=F6nig?= , 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 , Peter Zijlstra On 02/29, Michal Hocko wrote: > > @@ -267,7 +267,10 @@ static int __bprm_mm_init(struct linux_binprm *bprm) > if (!vma) > return -ENOMEM; > > - down_write(&mm->mmap_sem); > + if (down_write_killable(&mm->mmap_sem)) { > + err = -EINTR; > + goto err_free; > + } > vma->vm_mm = mm; I won't argue, but this looks unnecessary. Nobody else can see this new mm, down_write() can't block. In fact I think we can just remove down_write/up_write here. Except perhaps there is lockdep_assert_held() somewhere in these paths. Oleg. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:46216 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750843AbcB2RXm (ORCPT ); Mon, 29 Feb 2016 12:23:42 -0500 Date: Mon, 29 Feb 2016 18:23:34 +0100 From: Oleg Nesterov Subject: Re: [PATCH 13/18] exec: make exec path waiting for mmap_sem killable Message-ID: <20160229172333.GB3615@redhat.com> References: <1456752417-9626-1-git-send-email-mhocko@kernel.org> <1456752417-9626-14-git-send-email-mhocko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456752417-9626-14-git-send-email-mhocko@kernel.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Michal Hocko Cc: LKML , Andrew Morton , linux-mm@kvack.org, Alex Deucher , Alex Thorlton , Andrea Arcangeli , Andy Lutomirski , Benjamin LaHaise , Christian =?iso-8859-1?Q?K=F6nig?= , 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 , Peter Zijlstra , Petr Cermak , Thomas Gleixner , Michal Hocko , Alexander Viro Message-ID: <20160229172334.CTtKGOtCj4vuS5_1A-kAsjczB_wwryt0YwLWDCo6DWM@z> On 02/29, Michal Hocko wrote: > > @@ -267,7 +267,10 @@ static int __bprm_mm_init(struct linux_binprm *bprm) > if (!vma) > return -ENOMEM; > > - down_write(&mm->mmap_sem); > + if (down_write_killable(&mm->mmap_sem)) { > + err = -EINTR; > + goto err_free; > + } > vma->vm_mm = mm; I won't argue, but this looks unnecessary. Nobody else can see this new mm, down_write() can't block. In fact I think we can just remove down_write/up_write here. Except perhaps there is lockdep_assert_held() somewhere in these paths. Oleg.