Adjust the callers to only call PageReadahead on the head page. Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> --- include/linux/page-flags.h | 4 ++-- mm/filemap.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 00d8efd72496..8b523d25fccf 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -380,8 +380,8 @@ PAGEFLAG(MappedToDisk, mappedtodisk, PF_NO_TAIL) /* PG_readahead is only used for reads; PG_reclaim is only for writes */ PAGEFLAG(Reclaim, reclaim, PF_NO_TAIL) TESTCLEARFLAG(Reclaim, reclaim, PF_NO_TAIL) -PAGEFLAG(Readahead, reclaim, PF_NO_COMPOUND) - TESTCLEARFLAG(Readahead, reclaim, PF_NO_COMPOUND) +PAGEFLAG(Readahead, reclaim, PF_ONLY_HEAD) + TESTCLEARFLAG(Readahead, reclaim, PF_ONLY_HEAD) #ifdef CONFIG_HIGHMEM /* diff --git a/mm/filemap.c b/mm/filemap.c index dabc26cf0067..91145e33635d 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2892,10 +2892,10 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf, mmap_miss = READ_ONCE(ra->mmap_miss); if (mmap_miss) WRITE_ONCE(ra->mmap_miss, --mmap_miss); - if (PageReadahead(page)) { + if (PageReadahead(thp_head(page))) { fpin = maybe_unlock_mmap_for_io(vmf, fpin); page_cache_async_readahead(mapping, ra, file, - page, offset, ra->ra_pages); + thp_head(page), offset, ra->ra_pages); } return fpin; } -- 2.28.0