From: Mel Gorman <[email protected]>
Subject: mm: numa: defer TLB flush for THP migration as long as possible

THP migration can fail for a variety of reasons.  Avoid flushing the TLB
to deal with THP migration races until the copy is ready to start.

Signed-off-by: Mel Gorman <[email protected]>
Reviewed-by: Rik van Riel <[email protected]>
Cc: Alex Thorlton <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/huge_memory.c |    7 -------
 mm/migrate.c     |    3 +++
 2 files changed, 3 insertions(+), 7 deletions(-)

diff -puN 
mm/huge_memory.c~mm-numa-defer-tlb-flush-for-thp-migration-as-long-as-possible 
mm/huge_memory.c
--- 
a/mm/huge_memory.c~mm-numa-defer-tlb-flush-for-thp-migration-as-long-as-possible
+++ a/mm/huge_memory.c
@@ -1377,13 +1377,6 @@ int do_huge_pmd_numa_page(struct mm_stru
        }
 
        /*
-        * The page_table_lock above provides a memory barrier
-        * with change_protection_range.
-        */
-       if (mm_tlb_flush_pending(mm))
-               flush_tlb_range(vma, haddr, haddr + HPAGE_PMD_SIZE);
-
-       /*
         * Migrate the THP to the requested node, returns with page unlocked
         * and pmd_numa cleared.
         */
diff -puN 
mm/migrate.c~mm-numa-defer-tlb-flush-for-thp-migration-as-long-as-possible 
mm/migrate.c
--- a/mm/migrate.c~mm-numa-defer-tlb-flush-for-thp-migration-as-long-as-possible
+++ a/mm/migrate.c
@@ -1759,6 +1759,9 @@ int migrate_misplaced_transhuge_page(str
                goto out_fail;
        }
 
+       if (mm_tlb_flush_pending(mm))
+               flush_tlb_range(vma, mmun_start, mmun_end);
+
        /* Prepare a page as a migration target */
        __set_page_locked(new_page);
        SetPageSwapBacked(new_page);
_
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to