Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761301AbYBACbY (ORCPT ); Thu, 31 Jan 2008 21:31:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753260AbYBACbQ (ORCPT ); Thu, 31 Jan 2008 21:31:16 -0500 Received: from relay1.sgi.com ([192.48.171.29]:34634 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753405AbYBACbP (ORCPT ); Thu, 31 Jan 2008 21:31:15 -0500 Date: Thu, 31 Jan 2008 20:31:13 -0600 From: Robin Holt To: Christoph Lameter Cc: Andrea Arcangeli , Robin Holt , Avi Kivity , Izik Eidus , kvm-devel@lists.sourceforge.net, Peter Zijlstra , steiner@sgi.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, daniel.blueman@quadrics.com Subject: Re: [patch 1/3] mmu_notifier: Core code Message-ID: <20080201023113.GB26420@sgi.com> References: <20080131045750.855008281@sgi.com> <20080131045812.553249048@sgi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080131045812.553249048@sgi.com> User-Agent: Mutt/1.5.15+20070412 (2007-04-11) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2199 Lines: 60 Christoph, Jack has repeatedly pointed out needing an unregister outside the mmap_sem. I still don't see the benefit to not having the lock in the mm. Thanks, Robin Index: mmu_notifiers-cl-v4/include/linux/mm_types.h =================================================================== --- mmu_notifiers-cl-v4.orig/include/linux/mm_types.h 2008-01-31 19:56:08.000000000 -0600 +++ mmu_notifiers-cl-v4/include/linux/mm_types.h 2008-01-31 19:56:58.000000000 -0600 @@ -155,6 +155,7 @@ struct vm_area_struct { struct mmu_notifier_head { #ifdef CONFIG_MMU_NOTIFIER + spinlock_t list_lock; struct hlist_head head; #endif }; Index: mmu_notifiers-cl-v4/mm/mmu_notifier.c =================================================================== --- mmu_notifiers-cl-v4.orig/mm/mmu_notifier.c 2008-01-31 19:56:08.000000000 -0600 +++ mmu_notifiers-cl-v4/mm/mmu_notifier.c 2008-01-31 20:26:31.000000000 -0600 @@ -60,25 +60,19 @@ int mmu_notifier_age_page(struct mm_stru * Note that all notifiers use RCU. The updates are only guaranteed to be * visible to other processes after a RCU quiescent period! */ -void __mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm) -{ - hlist_add_head_rcu(&mn->hlist, &mm->mmu_notifier.head); -} -EXPORT_SYMBOL_GPL(__mmu_notifier_register); - void mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm) { - down_write(&mm->mmap_sem); - __mmu_notifier_register(mn, mm); - up_write(&mm->mmap_sem); + spin_lock(&mm->mmu_notifier.list_lock); + hlist_add_head_rcu(&mn->hlist, &mm->mmu_notifier.head); + spin_unlock(&mm->mmu_notifier.list_lock); } EXPORT_SYMBOL_GPL(mmu_notifier_register); void mmu_notifier_unregister(struct mmu_notifier *mn, struct mm_struct *mm) { - down_write(&mm->mmap_sem); + spin_lock(&mm->mmu_notifier.list_lock); hlist_del_rcu(&mn->hlist); - up_write(&mm->mmap_sem); + spin_unlock(&mm->mmu_notifier.list_lock); } EXPORT_SYMBOL_GPL(mmu_notifier_unregister); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/