diff mbox series

mm: HMM always needs MMU_NOTIFIER

Message ID 20170824230850.1810408-1-arnd@arndb.de
State New
Headers show
Series mm: HMM always needs MMU_NOTIFIER | expand

Commit Message

Arnd Bergmann Aug. 24, 2017, 11:08 p.m. UTC
When building a kernel with HMM enabled but without MMU_NOTIFIER,
we run into a build error:

mm/hmm.c:66:22: error: field 'mmu_notifier' has incomplete type
  struct mmu_notifier mmu_notifier;

If I read this right, the dependency is correct, but the #ifdef
annotations in the mm/hmm.c are not. This changes them in
a way to make it all build cleanly.

Fixes: e4e0061ea15c ("mm/device-public-memory: device memory cache coherent with CPU")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
I did not try very hard to understand what the code is
supposed to do, please check if this makes sense beyond fixing
the build before applying.
---
 mm/hmm.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

-- 
2.9.0

Comments

Andrew Morton Aug. 25, 2017, 8:01 p.m. UTC | #1
On Thu, 24 Aug 2017 20:42:26 -0400 jglisse@redhat.com wrote:

> 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.


It's unclear whether this patch is in addition to Arnd's "mm: HMM always
needs MMU_NOTIFIER" or is a replacement for it.  (If the latter, it
should have Arnd's Reported-by).  But I cannot get this patch to apply
cleanly in either situation.

So I'll skip both patches.  Please send something which applies on top
of

hmm-heterogeneous-memory-management-documentation-v3.patch
mm-hmm-heterogeneous-memory-management-hmm-for-short-v5.patch
mm-hmm-mirror-mirror-process-address-space-on-device-with-hmm-helpers-v3.patch
mm-hmm-mirror-helper-to-snapshot-cpu-page-table-v4.patch
mm-hmm-mirror-device-page-fault-handler.patch
mm-memory_hotplug-introduce-add_pages.patch
mm-zone_device-new-type-of-zone_device-for-unaddressable-memory-v5.patch
mm-zone_device-new-type-of-zone_device-for-unaddressable-memory-fix.patch
mm-zone_device-special-case-put_page-for-device-private-pages-v4.patch
mm-memcontrol-allow-to-uncharge-page-without-using-page-lru-field.patch
mm-memcontrol-support-memory_device_private-v4.patch
mm-hmm-devmem-device-memory-hotplug-using-zone_device-v7.patch
mm-hmm-devmem-dummy-hmm-device-for-zone_device-memory-v3.patch
mm-migrate-new-migrate-mode-migrate_sync_no_copy.patch
mm-migrate-new-memory-migration-helper-for-use-with-device-memory-v5.patch
mm-migrate-migrate_vma-unmap-page-from-vma-while-collecting-pages.patch
mm-migrate-support-un-addressable-zone_device-page-in-migration-v3.patch
mm-migrate-allow-migrate_vma-to-alloc-new-page-on-empty-entry-v4.patch
mm-device-public-memory-device-memory-cache-coherent-with-cpu-v5.patch
mm-hmm-add-new-helper-to-hotplug-cdm-memory-region-v3.patch
#
mm-hmm-avoid-bloating-arch-that-do-not-make-use-of-hmm.patch

thanks.
diff mbox series

Patch

diff --git a/mm/hmm.c b/mm/hmm.c
index 4a179a16ab10..b9e9f14e7454 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -41,11 +41,16 @@ 
  */
 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 */
 
+void hmm_mm_destroy(struct mm_struct *mm)
+{
+	kfree(mm->hmm);
+}
+
+#if IS_ENABLED(CONFIG_HMM_MIRROR)
+static const struct mmu_notifier_ops hmm_mmu_notifier_ops;
 
-#ifdef CONFIG_HMM
 /*
  * struct hmm - HMM per mm struct
  *
@@ -124,13 +129,6 @@  static struct hmm *hmm_register(struct mm_struct *mm)
 	return mm->hmm;
 }
 
-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,