• Andy Lutomirski's avatar
    x86/mm: Refactor flush_tlb_mm_range() to merge local and remote cases · 454bbad9
    Andy Lutomirski authored
    The local flush path is very similar to the remote flush path.
    Merge them.
    
    This is intended to make no difference to behavior whatsoever.  It
    removes some code and will make future changes to the flushing
    mechanics simpler.
    
    This patch does remove one small optimization: flush_tlb_mm_range()
    now has an unconditional smp_mb() instead of using MOV to CR3 or
    INVLPG as a full barrier when applicable.  I think this is okay for
    a few reasons.  First, smp_mb() is quite cheap compared to the cost
    of a TLB flush.  Second, this rearrangement makes a bigger
    optimization available: with some work on the SMP function call
    code, we could do the local and remote flushes in parallel.  Third,
    I'm planning a rework of the TLB flush algorithm that will require
    an atomic operation at the beginning of each flush, and that
    operation will replace the smp_mb().
    Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Arjan van de Ven <arjan@linux.intel.com>
    Cc: Borislav Petkov <bpetkov@suse.de>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Nadav Amit <nadav.amit@gmail.com>
    Cc: Nadav Amit <namit@vmware.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-mm@kvack.org
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    454bbad9
tlbflush.h 8.4 KB