Skip to content

x86,tlb,mm: make lazy TLB mode even lazier

Rik van Riel linux-arch linux-s390 linuxppc-dev lkml 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest7 patches 31 repliesIn review
  2. v57 patches 7 repliesSuperseded
  3. v47 patches 6 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v37 patches9 repliesSuperseded
v20 of 7 patches0 repliesSuperseded
v17 patches21 repliesSuperseded

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7mm: allocate mm_cpumask dynamically based on nr_cpu_idsdrivers/firmware/efi/efi.c include/linux/mm_types.h kernel/fork.c +1 more+145 -1231 reply
2/7x86,tlb: leave lazy TLB mode at page table free timearch/x86/include/asm/tlbflush.h arch/x86/mm/tlb.c include/asm-generic/tlb.h +1 more+56 -84 replies
3/7x86,mm: restructure switch_mm_irqs_offarch/x86/mm/tlb.c+30 -300 replies
4/7x86,tlb: make lazy TLB mode lazierarch/x86/mm/tlb.c+59 -924 replies
5/7x86,tlb: only send page table free TLB flush to lazy TLB CPUsarch/x86/mm/tlb.c+39 -42 replies
6/7x86,mm: always use lazy TLB modearch/x86/include/asm/tlbflush.h arch/x86/mm/tlb.c+1 -300 replies
7/7x86,switch_mm: skip atomic operations for init_mmarch/x86/mm/tlb.c+12 -50 replies

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by.

PatchDave HansenSong Liu
1/7A-b T-b
2/7A-b T-b
3/7A-b
4/7A-b T-b
5/7A-b T-b
6/7A-b T-b
7/7A-b Reported-and-tested-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/7] x86,tlb,mm: make lazy TLB mode even lazier

Song noticed switch_mm_irqs_off taking a lot of CPU time in recent kernels, using 1.9% of a 48 CPU system during a netperf run. Digging into the profile, the atomic operations in cpumask_clear_cpu and cpumask_set_cpu are responsible for about half of that CPU use.

However, the CPUs running netperf are simply switching back and forth between netperf and the idle task, which does not require any changes to the mm_cpumask if lazy TLB mode were used.

Additionally, the init_mm cpumask ends up being the most heavily contended one in the system, for no reason at all.

Making really lazy TLB mode work again on modern kernels, by sending a shootdown IPI only when page table pages are being unmapped, we get back some performance.

v6 addresses the comment and Signed-off-by issues pointed out by Ingo.

On memcache workloads on 2 socket systems, this patch series seems to reduce total system CPU use by 1-2%. On Song's netbench tests, CPU use in the context switch time is about cut in half.

These patches also provide a little memory savings by shrinking the size of mm_struct, especially on distro kernels compiled with a gigantically large NR_CPUS.