Commit b0943d61b8fa420180f92f64ef67662b4f6cc493

Authored by Mel Gorman
Committed by Linus Torvalds
1 parent af2c1401e6

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 <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Alex Thorlton <athorlton@sgi.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 3 additions and 7 deletions Side-by-side Diff

... ... @@ -1377,13 +1377,6 @@
1377 1377 }
1378 1378  
1379 1379 /*
1380   - * The page_table_lock above provides a memory barrier
1381   - * with change_protection_range.
1382   - */
1383   - if (mm_tlb_flush_pending(mm))
1384   - flush_tlb_range(vma, haddr, haddr + HPAGE_PMD_SIZE);
1385   -
1386   - /*
1387 1380 * Migrate the THP to the requested node, returns with page unlocked
1388 1381 * and pmd_numa cleared.
1389 1382 */
... ... @@ -1759,6 +1759,9 @@
1759 1759 goto out_fail;
1760 1760 }
1761 1761  
  1762 + if (mm_tlb_flush_pending(mm))
  1763 + flush_tlb_range(vma, mmun_start, mmun_end);
  1764 +
1762 1765 /* Prepare a page as a migration target */
1763 1766 __set_page_locked(new_page);
1764 1767 SetPageSwapBacked(new_page);