Skip to content

Readahead tweaks for larger folios

Ryan Roberts linux-arm-kernel linux-fsdevel linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest5 patches 5 repliesIn review 4 of 5 applied
  2. v4 RFC5 patches 34 repliesSuperseded

Patches in v5 4 of 5 applied

#Subject and filesSizeRepliesApplied
1/5mm/readahead: Honour new_order in page_cache_ra_order()mm/readahead.c+2 -90 repliesApplied
2/5mm/readahead: Terminate async readahead on natural boundarymm/readahead.c+7 -30 repliesApplied
3/5mm/readahead: Make space in struct file_ra_stateinclude/linux/fs.h mm/filemap.c+7 -61 replyApplied
4/5mm/readahead: Store folio order in struct file_ra_stateinclude/linux/fs.h mm/filemap.c mm/internal.h +1 more+20 -121 replyApplied
5/5mm/filemap: Allow arch to request folio size for exec memoryarch/arm64/include/asm/pgtable.h include/linux/pgtable.h mm/filemap.c+57 -93 replies

Reviews trailers per patch

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

PatchDavid HildenbrandJan KaraChaitanya S PrakashWill DeaconTao Xu
1/5A-b R-b T-b
2/5R-b
3/5A-b R-b
4/5R-b
5/5R-b A-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v5 thread

Cover letter [PATCH v5 0/5] Readahead tweaks for larger folios

Hi All,

This series adds some tweaks to readahead so that it does a better job of ramping up folio sizes as readahead extends further into the file. And it additionally special-cases executable mappings to allow the arch to request a preferred folio size for text.

Originally the series focussed on the latter part only (large folios for text). See [3]. But after discussion with Matthew Wilcox, v4 switched to additionally fix some of the unintended behaviours in how a folio size is selected in general before special-casing for text. As a result patches 1-4 make folio size selection behave more sanely, then patch 5 introduces large folios for text. Patch 5 depends on patch 1, but does not depend on patches 2-4.

---

I've run a number of benchmarks and observed no regressions. mm selftests also shows no regressions vs mm-unstable. Selected benchmark results are presented in the commit log for the final patch.

Most patches have R-b/A-b now so would be good to get into linux-next for some soak testing when possible.

Applies on top of today's mm-unstable (a32230de8810).

Changes since v4 [4]
====================

- Added R-b/A-b (thanks all!)
- Patch 1:
- Removed ra->size fallback check in page_cache_ra_order() (Pankaj)
- Patch 2:
- Modify ra end alignment to handle non-power-of-2 optimal ra sizes (Jan)
- Patch 4:
- Only reset order to 0 if fallback is due to not supporting large folios

    (Jan)

- Patch 5:
- Ignore VM_RAND_READ for VM_EXEC mappings in favour of following the new VM_EXEC code path since code is always random (Will)

Changes since v3 [3]
====================

- Added patchs 1-4 to do better job of ramping up folio order
- In patch 5:
- Confine readahead blocks to vma boundaries (per Kalesh)
- Rename arch_exec_folio_order() to exec_folio_order() (per Matthew)
- exec_folio_order() now returns unsigned int and defaults to order-0 (per Matthew)
- readahead size is honoured (including when disabled)

Changes since v2 [2]
====================

- Rename arch_wants_exec_folio_order() to arch_exec_folio_order() (per Andrew)
- Fixed some typos (per Andrew)

Changes since v1 [1]
====================

- Remove "void" from arch_wants_exec_folio_order() macro args list

[1] https://lore.kernel.org/linux-mm/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/linux-mm/[email protected]/
[4] https://lore.kernel.org/linux-mm/[email protected]/

Thanks,
Ryan

Ryan Roberts (5):
mm/readahead: Honour new_order in page_cache_ra_order() mm/readahead: Terminate async readahead on natural boundary mm/readahead: Make space in struct file_ra_state mm/readahead: Store folio order in struct file_ra_state mm/filemap: Allow arch to request folio size for exec memory

 arch/arm64/include/asm/pgtable.h |  8 +++++
 include/linux/fs.h               |  4 ++-
 include/linux/pgtable.h          | 11 ++++++
 mm/filemap.c                     | 62 ++++++++++++++++++++++++--------
 mm/internal.h                    |  3 +-
 mm/readahead.c                   | 36 ++++++++++---------
 6 files changed, 89 insertions(+), 35 deletions(-)

--
2.43.0