From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail190.messagelabs.com (mail190.messagelabs.com [216.82.249.51]) by kanga.kvack.org (Postfix) with SMTP id 1E1D46B0098 for ; Tue, 2 Feb 2010 11:39:37 -0500 (EST) Date: Tue, 2 Feb 2010 10:39:30 -0600 From: Robin Holt Subject: Re: [RFP-V2 0/3] Make mmu_notifier_invalidate_range_start able to sleep. Message-ID: <20100202163930.GR6653@sgi.com> References: <20100202125943.GH4135@random.random> <20100202131341.GI4135@random.random> <20100202132919.GO6653@sgi.com> <20100202134047.GJ4135@random.random> <20100202135141.GH6616@sgi.com> <20100202141036.GL4135@random.random> <20100202142130.GI6616@sgi.com> <20100202145911.GM4135@random.random> <20100202152142.GQ6653@sgi.com> <20100202160146.GO4135@random.random> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100202160146.GO4135@random.random> Sender: owner-linux-mm@kvack.org To: Andrea Arcangeli Cc: Robin Holt , Christoph Hellwig , Andrew Morton , Jack Steiner , linux-mm@kvack.org List-ID: On Tue, Feb 02, 2010 at 05:01:46PM +0100, Andrea Arcangeli wrote: > On Tue, Feb 02, 2010 at 09:21:42AM -0600, Robin Holt wrote: > > unmap_mapping_range_vma would then unlock the i_mmap_lock, call > > _inv_range_start(atomic==0) which would clear all the remote page tables > > and TLBs. It would then reaquire the i_mmap_lock and retry. > > I guess you missed why we hold the i_mmap_lock there... it's not like > gratuitous locking complication there's an actual reason why it's > taken, and it's to avoid the vma to be freed from under you: Oversight on my part. Sorry. Will this work? static int unmap_mapping_range_vma(struct vm_area_struct *vma, ... if (need_unlocked_invalidate) { mm = vma->vm_mm; atomic_inc(&mm->mm_users); } spin_unlock(details->i_mmap_lock); if (need_unlocked_invalidate) { /* * zap_page_range failed to make any progress because the * mmu_notifier_invalidate_range_start was called atomically * while the callee needed to sleep. In that event, we * make the callout while the i_mmap_lock is released. */ mmu_notifier_invalidate_range_start(mm, start_addr, end_addr, 0); mmu_notifier_invalidate_range_end(mm, start_addr, end_addr); mmput(mm); } cond_resched(); spin_lock(details->i_mmap_lock); return -EINTR; Robin -- 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