Skip to content

shmem: high order folios support in write path

Daniel Gomez linux-block linux-fsdevel linux-mm linux-xfs lkml llvm oe-kbuild-all 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 3 repliesIn review
  2. v16 patches 22 repliesSuperseded

Changes in v2 from the cover letter

- fsx: 4,9B
- fstests: Same result as baseline for next-230918. V1:
- fsx: 2d test, 21,5B
- fstests: Same result as baseline for next-230911 [3][4][5]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6shmem: drop BLOCKS_PER_PAGE macromm/shmem.c+0 -10 replies
2/6shmem: return freed pages in shmem_free_swapmm/shmem.c+8 -61 reply
3/6shmem: account for large order foliosmm/shmem.c+11 -90 replies
4/6shmem: add order parameter support to shmem_alloc_foliomm/shmem.c+13 -90 replies
5/6shmem: add file length in shmem_get_folio pathinclude/linux/shmem_fs.h mm/khugepaged.c mm/shmem.c+20 -160 replies
6/6shmem: add large folios support to the write pathmm/shmem.c+52 -142 replies

Reviews trailers per patch

1 of 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchLuis ChamberlainDaniel Gomez
SeriesR-b R-b R-b T-b
1/6R-b
2/6
3/6
4/6
5/6
6/6

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

Read the v2 thread

Cover letter [PATCH v2 0/6] shmem: high order folios support in write path

This series add support for high order folios in shmem write path when swap is disabled (noswap option). This is part of the Large Block Size (LBS) effort [1][2] and a continuation of the shmem work from Luis here [3] following Matthew Wilcox's suggestion [4] regarding the path to take for the folio allocation order calculation.

[1] https://kernelnewbies.org/KernelProjects/large-block-size
[2] https://docs.google.com/spreadsheets/d/e/2PACX-1vS7sQfw90S00l2rfOKm83Jlg0px8KxMQE4HHp_DKRGbAGcAV-xu6LITHBEc4xzVh9wLH6WM2lR0cZS8/pubhtml#
[3] RFC v2 add support for blocksize > PAGE_SIZE
https://lore.kernel.org/all/[email protected]/T/#md3e93ab46ce2ad9254e1eb54ffe71211988b5632
[4] https://lore.kernel.org/all/[email protected]/

fsx and fstests has been performed on tmpfs with noswap with the following results:
V2:
- fsx: 4,9B
- fstests: Same result as baseline for next-230918. V1:
- fsx: 2d test, 21,5B
- fstests: Same result as baseline for next-230911 [3][4][5]

Patches have been tested and sent from next-230918.

[3] Baseline next-230911 failures are: generic/080 generic/126 generic/193 generic/633 generic/689
[4] fstests logs baseline: https://gitlab.com/-/snippets/3598621
[5] fstests logs patches: https://gitlab.com/-/snippets/3598628

Note: because of next-230918 regression in rmap, patch [8] applied.

[8] [email protected]

Daniel

Changes since v1
* Order handling code simplified in shmem_get_folio_gfp after Matthew Willcox's review.
* Drop patch 1/6 [6] and merge mapping_size_order code directly in shmem.
* Added MAX_SHMEM_ORDER to make it explicit we don't have the same max order as in pagecache (MAX_PAGECACHE_ORDER).
* Use HPAGE_PMD_ORDER-1 as MAX_SHMEM_ORDER to respect huge mount option.
* Update cover letter: drop huge strategy question and add more context regarding LBS project. Add fsx and fstests summary with new baseline.
* Add fixes found by Matthew in patch 3/6 [7].
* Fix length (i_size_read -> PAGE_SIZE) that is passed to shmem_get_folio_gfp in shmem_fault and shmem_read_folio_gfp to PAGE_SIZE.
* Add patch as suggested by Matthew to return the number of pages freed in shmem_free_swap (instead of errno). When no pages are freed, return 0 (pages).
Note: As an alternative, we can embed -ENOENT and make use of IS_ERR_VALUE. Approach discarded because little value was added. If this method is preferred, please let discuss it.

[6] filemap: make the folio order calculation shareable
[7] shmem: account for large order folios

Daniel Gomez (5):
shmem: drop BLOCKS_PER_PAGE macro
shmem: return freed pages in shmem_free_swap
shmem: add order parameter support to shmem_alloc_folio
shmem: add file length in shmem_get_folio path
shmem: add large folios support to the write path

Luis Chamberlain (1):
shmem: account for large order folios

 include/linux/shmem_fs.h |   2 +-
 mm/khugepaged.c          |   2 +-
 mm/shmem.c               | 141 ++++++++++++++++++++++++++-------------
 3 files changed, 97 insertions(+), 48 deletions(-)

--
2.39.2