From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753334AbcB2Ry3 (ORCPT ); Mon, 29 Feb 2016 12:54:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53638 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753252AbcB2RyZ (ORCPT ); Mon, 29 Feb 2016 12:54:25 -0500 Date: Mon, 29 Feb 2016 18:54:18 +0100 From: Oleg Nesterov 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 Subject: Re: [PATCH 08/18] mm, fork: make dup_mmap wait for mmap_sem for write killable Message-ID: <20160229175418.GD3615@redhat.com> References: <1456752417-9626-1-git-send-email-mhocko@kernel.org> <1456752417-9626-9-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-9-git-send-email-mhocko@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/29, Michal Hocko wrote: > > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -413,7 +413,10 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) > unsigned long charge; > > uprobe_start_dup_mmap(); > - down_write(&oldmm->mmap_sem); > + if (down_write_killable(&oldmm->mmap_sem)) { > + uprobe_end_dup_mmap(); > + return -EINTR; > + } This is really cosmetic and subjective, I won't insist if you prefer it this way. But perhaps it makes sense to add another "fail" label above uprobe_end_dup_mmap() we already have... IMO it is always better to avoid duplicating when it comes to "unlock". Oleg. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [PATCH 08/18] mm, fork: make dup_mmap wait for mmap_sem for write killable Date: Mon, 29 Feb 2016 18:54:18 +0100 Message-ID: <20160229175418.GD3615@redhat.com> References: <1456752417-9626-1-git-send-email-mhocko@kernel.org> <1456752417-9626-9-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]:53638 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753252AbcB2RyZ (ORCPT ); Mon, 29 Feb 2016 12:54:25 -0500 Content-Disposition: inline In-Reply-To: <1456752417-9626-9-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: > > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -413,7 +413,10 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) > unsigned long charge; > > uprobe_start_dup_mmap(); > - down_write(&oldmm->mmap_sem); > + if (down_write_killable(&oldmm->mmap_sem)) { > + uprobe_end_dup_mmap(); > + return -EINTR; > + } This is really cosmetic and subjective, I won't insist if you prefer it this way. But perhaps it makes sense to add another "fail" label above uprobe_end_dup_mmap() we already have... IMO it is always better to avoid duplicating when it comes to "unlock". Oleg. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qg0-f42.google.com (mail-qg0-f42.google.com [209.85.192.42]) by kanga.kvack.org (Postfix) with ESMTP id C8BB3828E1 for ; Mon, 29 Feb 2016 12:54:26 -0500 (EST) Received: by mail-qg0-f42.google.com with SMTP id y9so122946037qgd.3 for ; Mon, 29 Feb 2016 09:54:26 -0800 (PST) Date: Mon, 29 Feb 2016 18:54:18 +0100 From: Oleg Nesterov Subject: Re: [PATCH 08/18] mm, fork: make dup_mmap wait for mmap_sem for write killable Message-ID: <20160229175418.GD3615@redhat.com> References: <1456752417-9626-1-git-send-email-mhocko@kernel.org> <1456752417-9626-9-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-9-git-send-email-mhocko@kernel.org> Sender: owner-linux-mm@kvack.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 On 02/29, Michal Hocko wrote: > > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -413,7 +413,10 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) > unsigned long charge; > > uprobe_start_dup_mmap(); > - down_write(&oldmm->mmap_sem); > + if (down_write_killable(&oldmm->mmap_sem)) { > + uprobe_end_dup_mmap(); > + return -EINTR; > + } This is really cosmetic and subjective, I won't insist if you prefer it this way. But perhaps it makes sense to add another "fail" label above uprobe_end_dup_mmap() we already have... IMO it is always better to avoid duplicating when it comes to "unlock". Oleg. -- 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