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

From: Daniel Gomez
Date: Tue Sep 19 2023 - 09:56:02 EST


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/ZHBowMEDfyrAAOWH@xxxxxxxxxxxxxxxxxxxxxx/T/#md3e93ab46ce2ad9254e1eb54ffe71211988b5632
[4] https://lore.kernel.org/all/ZHD9zmIeNXICDaRJ@xxxxxxxxxxxxxxxxxxxx/

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] 20230918151729.5A1F4C32796@xxxxxxxxxxxxxxx

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