Re: [PATCH -v2 1/4] mm: Rework {set,clear,mm}_tlb_flush_pending()

From: Will Deacon
Date: Thu Aug 03 2017 - 11:27:42 EST

On Wed, Aug 02, 2017 at 01:38:38PM +0200, Peter Zijlstra wrote:
> Commit:
> af2c1401e6f9 ("mm: numa: guarantee that tlb_flush_pending updates are visible before page table updates")
> added smp_mb__before_spinlock() to set_tlb_flush_pending(). I think we
> can solve the same problem without this barrier.
> If instead we mandate that mm_tlb_flush_pending() is used while
> holding the PTL we're guaranteed to observe prior
> set_tlb_flush_pending() instances.
> For this to work we need to rework migrate_misplaced_transhuge_page()
> a little and move the test up into do_huge_pmd_numa_page().
> NOTE: this relies on flush_tlb_range() to guarantee:
> (1) it ensures that prior page table updates are visible to the
> page table walker and
> (2) it ensures that subsequent memory accesses are only made
> visible after the invalidation has completed

Works for me:

Acked-by: Will Deacon <will.deacon@xxxxxxx>