linux-kernelorg-stable/arch
Nadav Amit aa44284960 x86/mm/tlb: Avoid reading mm_tlb_gen when possible
On extreme TLB shootdown storms, the mm's tlb_gen cacheline is highly
contended and reading it should (arguably) be avoided as much as
possible.

Currently, flush_tlb_func() reads the mm's tlb_gen unconditionally,
even when it is not necessary (e.g., the mm was already switched).
This is wasteful.

Moreover, one of the existing optimizations is to read mm's tlb_gen to
see if there are additional in-flight TLB invalidations and flush the
entire TLB in such a case. However, if the request's tlb_gen was already
flushed, the benefit of checking the mm's tlb_gen is likely to be offset
by the overhead of the check itself.

Running will-it-scale with tlb_flush1_threads show a considerable
benefit on 56-core Skylake (up to +24%):

threads		Baseline (v5.17+)	+Patch
1		159960			160202
5		310808			308378 (-0.7%)
10		479110			490728
15		526771			562528
20		534495			587316
25		547462			628296
30		579616			666313
35		594134			701814
40		612288			732967
45		617517			749727
50		637476			735497
55		614363			778913 (+24%)

Signed-off-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20220606180123.2485171-1-namit@vmware.com
2022-06-07 08:48:03 -07:00
..
alpha
arc ARC: remove redundant READ_ONCE() in cmpxchg loop 2022-04-18 14:47:05 -07:00
arm Perf events changes for this cycle were: 2022-05-24 10:59:38 -07:00
arm64 Perf events changes for this cycle were: 2022-05-24 10:59:38 -07:00
csky csky: Move $(core-y) into arch/csky/Kbuild 2022-05-13 15:09:28 +08:00
h8300
hexagon
ia64
m68k Perf events changes for this cycle were: 2022-05-24 10:59:38 -07:00
microblaze
mips MIPS: Fix CP0 counter erratum detection for R4k CPUs 2022-04-29 15:52:00 +02:00
nios2
openrisc
parisc parisc: Fix patch code locking and flushing 2022-05-17 21:52:59 +02:00
powerpc - Remove all the code around GS switching on 32-bit now that it is not 2022-05-23 18:42:07 -07:00
riscv - Remove all the code around GS switching on 32-bit now that it is not 2022-05-23 18:42:07 -07:00
s390 s390 updates for 5.19 merge window 2022-05-23 21:01:30 -07:00
sh
sparc Linux 5.18-rc5 2022-05-11 16:27:06 +02:00
um ubd: don't set the discard_alignment queue limit 2022-05-03 10:38:50 -06:00
x86 x86/mm/tlb: Avoid reading mm_tlb_gen when possible 2022-06-07 08:48:03 -07:00
xtensa xtensa: Return true/false (not 1/0) from bool function 2022-05-23 00:33:05 -07:00
.gitignore
Kconfig Objtool changes for this cycle were: 2022-05-24 10:36:38 -07:00