Skip to contentSkip to conversation

mm/hmm: struct hmm is only use by HMM mirror functionality v2

PATCH New [email protected] 1 participant 1 message Aug 25, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/hmm: struct hmm is only use by HMM mirror functionality v2

From: Jérôme Glisse <[email protected]>

The struct hmm is only use if the HMM mirror functionality is enabled move associated code behind CONFIG_HMM_MIRROR to avoid build error if one enable some of the HMM memory configuration without the mirror feature.

Changed since v1:
- make it clear that it replace Arnd patch
- make sure it apply on top of lastest mm

Cc Andrew Morton <[email protected]>,
Cc Stephen Rothwell <[email protected]>,
Cc Subhash Gutti <[email protected]>,
Cc Evgeny Baskakov <[email protected]>
---
 include/linux/hmm.h | 8 ++++----
 mm/hmm.c            | 7 +++----
 2 files changed, 7 insertions(+), 8 deletions(-)
include/linux/hmm.h +4 -4
index 5866f3194c26..9583d9a15f9c 100644
@@ -501,18 +501,18 @@ void hmm_device_put(struct hmm_device *hmm_device);
 
 
 /* Below are for HMM internal use only! Not to be used by device driver! */
+#if IS_ENABLED(CONFIG_HMM_MIRROR)
 void hmm_mm_destroy(struct mm_struct *mm);
 
 static inline void hmm_mm_init(struct mm_struct *mm)
 {
 	mm->hmm = NULL;
 }
-
-#else /* IS_ENABLED(CONFIG_HMM) */
-
-/* Below are for HMM internal use only! Not to be used by device driver! */
+#else /* IS_ENABLED(CONFIG_HMM_MIRROR) */
 static inline void hmm_mm_destroy(struct mm_struct *mm) {}
 static inline void hmm_mm_init(struct mm_struct *mm) {}
+#endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */
+
 
 #endif /* IS_ENABLED(CONFIG_HMM) */
 #endif /* LINUX_HMM_H */
mm/hmm.c +3 -4
index 4a179a16ab10..cf9cf0db809e 100644
@@ -41,11 +41,12 @@
  */
 DEFINE_STATIC_KEY_FALSE(device_private_key);
 EXPORT_SYMBOL(device_private_key);
-static const struct mmu_notifier_ops hmm_mmu_notifier_ops;
 #endif /* CONFIG_DEVICE_PRIVATE || CONFIG_DEVICE_PUBLIC */
 
 
-#ifdef CONFIG_HMM
+#if IS_ENABLED(CONFIG_HMM_MIRROR)
+static const struct mmu_notifier_ops hmm_mmu_notifier_ops;
+
 /*
  * struct hmm - HMM per mm struct
  *
@@ -128,9 +129,7 @@ void hmm_mm_destroy(struct mm_struct *mm)
 {
 	kfree(mm->hmm);
 }
-#endif /* CONFIG_HMM */
 
-#if IS_ENABLED(CONFIG_HMM_MIRROR)
 static void hmm_invalidate_range(struct hmm *hmm,
 				 enum hmm_update_type action,
 				 unsigned long start,
Signature · 1 line
2.13.4