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);
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to