After months of merging prep patches, here's the end result. It holds up to xfstests on both shmem and xfs. It's based on linux-next as of a couple of days ago, plus several of the patches I've sent in the last week: https://lore.kernel.org/linux-mm/20201026041408.25230-1-willy@xxxxxxxxxxxxx/ https://lore.kernel.org/linux-mm/20201026151849.24232-1-willy@xxxxxxxxxxxxx/ https://lore.kernel.org/linux-mm/20201026183136.10404-1-willy@xxxxxxxxxxxxx/ You can get a complete git tree here: http://git.infradead.org/users/willy/pagecache.git/shortlog/refs/heads/next This tree only includes support for XFS. It would probably be straightforward to add support to ZoneFS (which also uses iomap), but I haven't looked into it. Dave Howells has AFS support working based on these patches: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=fscache-thp Matthew Wilcox (Oracle) (18): XArray: Expose xas_destroy mm: Use multi-index entries in the page cache mm: Support arbitrary THP sizes mm: Change NR_FILE_THPS to account in base pages mm/filemap: Rename generic_file_buffered_read subfunctions mm/filemap: Change calling convention for gfbr_ functions mm/filemap: Use head pages in generic_file_buffered_read mm/filemap: Add __page_cache_alloc_order mm/filemap: Allow THPs to be added to the page cache mm/vmscan: Optimise shrink_page_list for smaller THPs mm/filemap: Allow PageReadahead to be set on head pages mm: Pass a sleep state to put_and_wait_on_page_locked mm/filemap: Support readpage splitting a page mm/filemap: Inline __wait_on_page_locked_async into caller mm/readahead: Add THP readahead mm/readahead: Switch to page_cache_ra_order mm/filemap: Support VM_HUGEPAGE for file mappings selftests/vm/transhuge-stress: Support file-backed THPs William Kucharski (1): mm/readahead: Align THP mappings for non-DAX drivers/base/node.c | 3 +- fs/proc/meminfo.c | 2 +- include/linux/huge_mm.h | 8 +- include/linux/mm.h | 42 +- include/linux/mmzone.h | 2 +- include/linux/page-flags.h | 4 +- include/linux/pagemap.h | 37 +- include/linux/xarray.h | 1 + lib/xarray.c | 7 +- mm/filemap.c | 399 ++++++++++-------- mm/huge_memory.c | 31 +- mm/internal.h | 4 +- mm/khugepaged.c | 15 +- mm/migrate.c | 12 +- mm/readahead.c | 102 ++++- mm/shmem.c | 11 +- mm/vmscan.c | 3 +- tools/testing/selftests/vm/transhuge-stress.c | 36 +- 18 files changed, 430 insertions(+), 289 deletions(-) -- 2.28.0