powerpc/64s/radix: Check for no TLB flush required
authorNicholas Piggin <npiggin@gmail.com>
Thu, 17 Dec 2020 13:47:27 +0000 (23:47 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 8 Feb 2021 14:09:44 +0000 (01:09 +1100)
commit54bb503345b81399575e2b7a3a6497ae212ad827
treea2a9a2f664750f975959c2f59f36ff7767a87999
parent26418b36a11f2eaf2556aa8cefe86132907e311f
powerpc/64s/radix: Check for no TLB flush required

If there are no CPUs in mm_cpumask, no TLB flush is required at all.
This patch adds a check for this case.

Currently it's not tested for, in fact mm_is_thread_local() returns
false if the current CPU is not in mm_cpumask, so it's treated as a
global flush.

This can come up in some cases like exec failure before the new mm has
ever been switched to. This patch reduces TLBIE instructions required
to build a kernel from about 120,000 to 45,000. Another situation it
could help is page reclaim, KSM, THP, etc., (i.e., asynch operations
external to the process) where the process is sleeping and has all TLBs
flushed out of all CPUs.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201217134731.488135-4-npiggin@gmail.com
arch/powerpc/mm/book3s64/radix_tlb.c