Merge tag 'for-5.9/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/devic...
[linux-2.6-microblaze.git] / mm / migrate.c
index f377296..d179657 100644 (file)
@@ -1160,22 +1160,11 @@ out:
        return rc;
 }
 
-/*
- * gcc 4.7 and 4.8 on arm get an ICEs when inlining unmap_and_move().  Work
- * around it.
- */
-#if defined(CONFIG_ARM) && \
-       defined(GCC_VERSION) && GCC_VERSION < 40900 && GCC_VERSION >= 40700
-#define ICE_noinline noinline
-#else
-#define ICE_noinline
-#endif
-
 /*
  * Obtain the lock on page, remove all ptes and migrate the page
  * to the newly allocated page in newpage.
  */
-static ICE_noinline int unmap_and_move(new_page_t get_new_page,
+static int unmap_and_move(new_page_t get_new_page,
                                   free_page_t put_new_page,
                                   unsigned long private, struct page *page,
                                   int force, enum migrate_mode mode,
@@ -2287,7 +2276,9 @@ again:
                                goto next;
 
                        page = device_private_entry_to_page(entry);
-                       if (page->pgmap->owner != migrate->src_owner)
+                       if (!(migrate->flags &
+                               MIGRATE_VMA_SELECT_DEVICE_PRIVATE) ||
+                           page->pgmap->owner != migrate->pgmap_owner)
                                goto next;
 
                        mpfn = migrate_pfn(page_to_pfn(page)) |
@@ -2295,7 +2286,7 @@ again:
                        if (is_write_device_private_entry(entry))
                                mpfn |= MIGRATE_PFN_WRITE;
                } else {
-                       if (migrate->src_owner)
+                       if (!(migrate->flags & MIGRATE_VMA_SELECT_SYSTEM))
                                goto next;
                        pfn = pte_pfn(pte);
                        if (is_zero_pfn(pfn)) {
@@ -2390,8 +2381,14 @@ static void migrate_vma_collect(struct migrate_vma *migrate)
 {
        struct mmu_notifier_range range;
 
-       mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL,
-                       migrate->vma->vm_mm, migrate->start, migrate->end);
+       /*
+        * Note that the pgmap_owner is passed to the mmu notifier callback so
+        * that the registered device driver can skip invalidating device
+        * private page mappings that won't be migrated.
+        */
+       mmu_notifier_range_init_migrate(&range, 0, migrate->vma,
+               migrate->vma->vm_mm, migrate->start, migrate->end,
+               migrate->pgmap_owner);
        mmu_notifier_invalidate_range_start(&range);
 
        walk_page_range(migrate->vma->vm_mm, migrate->start, migrate->end,