mbox series

[v1,0/4] Optimize mmap_exit for large folios

Message ID 20230810103332.3062143-1-ryan.roberts@arm.com (mailing list archive)
Headers show
Series Optimize mmap_exit for large folios | expand

Message

Ryan Roberts Aug. 10, 2023, 10:33 a.m. UTC
Hi All,

This is a series to improve performance of process teardown, taking
advantage of the fact that large folios are increasingly regularly
pte-mapped in user space; supporting filesystems already use large
folios for pagecache memory, and large folios for anonymous memory are
(hopefully) on the horizon.

See last patch for performance numbers, including measurements that show
this approach doesn't regress (and actually improves a little bit) when
all folios are small.

The basic approach is to accumulate contiguous ranges of pages in the
mmu_gather structure (instead of storing each individual page pointer),
then take advantage of this internal format to efficiently batch rmap
removal, swapcache removal and page release - see the commit messages
for more details.

This series replaces the previous approach I took at [1], which was much
smaller in scope, only attempting to batch rmap removal for anon pages.
Feedback was that I should do something more general that would also
batch-remove pagecache pages from the rmap. But while designing that, I
found it was also possible to improve swapcache removal and page
release. Hopefully I haven't gone too far the other way now! Note that
patch 1 is unchanged from that originl series.

This series is based on mm-unstable (ad3232df3e41).

I'm going to be out on holiday from the end of today, returning on 29th
August. So responses will likely be patchy, as I'm terrified of posting
to list from my phone!

[1] https://lore.kernel.org/linux-mm/20230727141837.3386072-1-ryan.roberts@arm.com/

Thanks,
Ryan


Ryan Roberts (4):
  mm: Implement folio_remove_rmap_range()
  mm/mmu_gather: generalize mmu_gather rmap removal mechanism
  mm/mmu_gather: Remove encoded_page infrastructure
  mm/mmu_gather: Store and process pages in contig ranges

 arch/s390/include/asm/tlb.h |   9 +--
 include/asm-generic/tlb.h   |  49 +++++++-------
 include/linux/mm.h          |  11 +++-
 include/linux/mm_types.h    |  34 +---------
 include/linux/rmap.h        |   2 +
 include/linux/swap.h        |   6 +-
 mm/memory.c                 |  24 ++++---
 mm/mmu_gather.c             | 112 +++++++++++++++++++++++---------
 mm/rmap.c                   | 125 +++++++++++++++++++++++++++---------
 mm/swap.c                   |  99 ++++++++++++++++++++++++++--
 mm/swap_state.c             |  11 ++--
 11 files changed, 333 insertions(+), 149 deletions(-)

--
2.25.1