[PATCH 1/9] mm: move mmu_find_ops to mmu_notifier.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For use by other modules.

Signed-off-by: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>
---
 drivers/misc/sgi-gru/grutlbpurge.c | 19 -------------------
 include/linux/mmu_notifier.h       |  8 ++++++++
 mm/mmu_notifier.c                  | 19 +++++++++++++++++++
 3 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/misc/sgi-gru/grutlbpurge.c
index 2129274..0f86892 100644
--- a/drivers/misc/sgi-gru/grutlbpurge.c
+++ b/drivers/misc/sgi-gru/grutlbpurge.c
@@ -275,25 +275,6 @@ static const struct mmu_notifier_ops gru_mmuops = {
 	.release		= gru_release,
 };
 
-/* Move this to the basic mmu_notifier file. But for now... */
-static struct mmu_notifier *mmu_find_ops(struct mm_struct *mm,
-			const struct mmu_notifier_ops *ops)
-{
-	struct mmu_notifier *mn, *gru_mn = NULL;
-
-	if (mm->mmu_notifier_mm) {
-		rcu_read_lock();
-		hlist_for_each_entry_rcu(mn, &mm->mmu_notifier_mm->list,
-					 hlist)
-		    if (mn->ops == ops) {
-			gru_mn = mn;
-			break;
-		}
-		rcu_read_unlock();
-	}
-	return gru_mn;
-}
-
 struct gru_mm_struct *gru_register_mmu_notifier(void)
 {
 	struct gru_mm_struct *gms;
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 61cd67f..0a78f5e 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -215,6 +215,8 @@ extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
 				  unsigned long start, unsigned long end);
 extern void __mmu_notifier_invalidate_range(struct mm_struct *mm,
 				  unsigned long start, unsigned long end);
+extern struct mmu_notifier *mmu_find_ops(struct mm_struct *mm,
+					 const struct mmu_notifier_ops *ops);
 
 static inline void mmu_notifier_release(struct mm_struct *mm)
 {
@@ -425,6 +427,12 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
 {
 }
 
+static inline struct mmu_notifier *mmu_find_ops(struct mm_struct *mm,
+						struct mmu_notifier_ops *ops)
+{
+	return NULL;
+}
+
 #define ptep_clear_flush_young_notify ptep_clear_flush_young
 #define pmdp_clear_flush_young_notify pmdp_clear_flush_young
 #define	ptep_clear_flush_notify ptep_clear_flush
diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
index 3b9b3d0..d978138 100644
--- a/mm/mmu_notifier.c
+++ b/mm/mmu_notifier.c
@@ -389,6 +389,25 @@ void mmu_notifier_unregister_no_release(struct mmu_notifier *mn,
 }
 EXPORT_SYMBOL_GPL(mmu_notifier_unregister_no_release);
 
+struct mmu_notifier *mmu_find_ops(struct mm_struct *mm,
+				  const struct mmu_notifier_ops *ops)
+{
+	struct mmu_notifier *mn, *tmp_mn = NULL;
+
+	if (mm->mmu_notifier_mm) {
+		rcu_read_lock();
+		hlist_for_each_entry_rcu(mn, &mm->mmu_notifier_mm->list,
+					 hlist)
+		    if (mn->ops == ops) {
+			tmp_mn = mn;
+			break;
+		}
+		rcu_read_unlock();
+	}
+	return tmp_mn;
+}
+EXPORT_SYMBOL_GPL(mmu_find_ops);
+
 static int __init mmu_notifier_init(void)
 {
 	return init_srcu_struct(&srcu);
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux