[PATCH 0/2] mm/filemap: reduce unnecessary xarray lookups

From: Chi Zhiling

Date: Sat Jun 20 2026 - 02:26:38 EST


From: Chi Zhiling <chizhiling@xxxxxxxxxx>

This series optimizes xarray lookups in filemap by avoiding redundant
iterations after obtaining the last needed folio. The boundary check is
moved to before advancing the xarray iterator, eliminating unnecessary
lookups and branches in the fast path. This reduces the overhead of
filemap_get_read_batch() from 2.91% to 2.53% in 4k read tests.

This series is split from a previous patch series:
https://lore.kernel.org/linux-mm/20260601055704.167436-1-chizhiling@xxxxxxx/

Chi Zhiling (2):
mm/filemap: reduce unnecessary xarray lookups when read cached pages
mm/filemap: reduce unnecessary xarray lookups in filemap_get_folios_contig()

mm/filemap.c | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)

--
2.43.0