skip redundant TLB sync IPIs
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest posting 2/22 patches 11 repliesIn review
- v3 posting 1/22 patches 0 repliesSuperseded
- v2 posting 2/23 patches 12 repliesSuperseded
Earlier versions · 3
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 posting 1/2 | 0 of 3 patches | 0 replies | Superseded | |
| v1 posting 2/2 | 3 patches | 0 replies | Superseded | |
| v1 posting 1/2 | 3 patches | 0 replies | Superseded |
Changes in v3 from the cover letter
- Complete rewrite: use dynamic IPI tracking instead of static checks (per Dave Hansen, thanks!)
- Track IPIs via mmu_gather: native_flush_tlb_multi() sets flag when actually sending IPIs
- Motivation for skipping redundant IPIs explained by David:
https://lore.kernel.org/linux-mm/[email protected]/
- https://lore.kernel.org/linux-mm/[email protected]/
Patches in v3 posting 2/2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | mm/tlb: skip redundant IPI when TLB flush already synchronizedarch/ arch/ arch/ +4 more | +53 | 9 replies | |
| 2/2 | mm: introduce pmdp_collapse_flush_sync() to skip redundant IPIinclude/ mm/ mm/ | +46 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH RESEND v3 0/2] skip redundant TLB sync IPIs
Hi all,
When unsharing hugetlb PMD page tables or collapsing pages in khugepaged, we send two IPIs: one for TLB invalidation, and another to synchronize with concurrent GUP-fast walkers. However, if the TLB flush already reaches all CPUs, the second IPI is redundant. GUP-fast runs with IRQs disabled, so when the TLB flush IPI completes, any concurrent GUP-fast must have finished.
We now track whether IPIs were actually sent during TLB flush. We pass the mmu_gather context through the flush path, and native_flush_tlb_multi() sets a flag when sending IPIs. Works with PV and INVLPGB since only native_flush_tlb_multi() sets the flag - no matter what replaces pv_ops.mmu.flush_tlb_multi or whether INVLPGB is available.
David Hildenbrand did the initial implementation. I built on his work and relied on off-list discussions to push it further - thanks a lot David!
v2 -> v3:
- Complete rewrite: use dynamic IPI tracking instead of static checks (per Dave Hansen, thanks!)
- Track IPIs via mmu_gather: native_flush_tlb_multi() sets flag when actually sending IPIs
- Motivation for skipping redundant IPIs explained by David:
https://lore.kernel.org/linux-mm/[email protected]/
- https://lore.kernel.org/linux-mm/[email protected]/
v1 -> v2:
- Fix cover letter encoding to resolve send-email issues. Apologies for any email flood caused by the failed send attempts :(
RFC -> v1:
- Use a callback function in pv_mmu_ops instead of comparing function pointers (per David)
- Embed the check directly in tlb_remove_table_sync_one() instead of requiring every caller to check explicitly (per David)
- Move tlb_table_flush_implies_ipi_broadcast() outside of CONFIG_MMU_GATHER_RCU_TABLE_FREE to fix build error on architectures that don't enable this config.
https://lore.kernel.org/oe-kbuild-all/[email protected]/
- https://lore.kernel.org/linux-mm/[email protected]/
Lance Yang (2):
mm/tlb: skip redundant IPI when TLB flush already synchronized
mm: introduce pmdp_collapse_flush_sync() to skip redundant IPI
arch/x86/include/asm/tlb.h | 3 ++- arch/x86/include/asm/tlbflush.h | 9 +++++---- arch/x86/kernel/alternative.c | 2 +- arch/x86/kernel/ldt.c | 2 +- arch/x86/mm/tlb.c | 22 +++++++++++++++------ include/asm-generic/tlb.h | 14 +++++++++----- include/linux/pgtable.h | 13 +++++++++---- mm/khugepaged.c | 9 +++------ mm/mmu_gather.c | 26 ++++++++++++++++++------- mm/pgtable-generic.c | 34 +++++++++++++++++++++++++++++++++ 10 files changed, 99 insertions(+), 35 deletions(-)
Signature · 1 line
2.49.0