The patch titled Subject: page-cache-store-only-head-pages-in-i_pages-fix-fix has been added to the -mm tree. Its filename is page-cache-store-only-head-pages-in-i_pages-fix-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/page-cache-store-only-head-pages-in-i_pages-fix-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/page-cache-store-only-head-pages-in-i_pages-fix-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx> Subject: page-cache-store-only-head-pages-in-i_pages-fix-fix hugetlb stores pages in page cache differently. Link: http://lkml.kernel.org/r/20190404134553.vuvhgmghlkiw2hgl@kshutemo-mobl1 Tested-by: Qian Cai <cai@xxxxxx> Cc: William Kucharski <william.kucharski@xxxxxxxxxx> Cc: Song Liu <songliubraving@xxxxxx> Cc: Song Liu <liu.song.a23@xxxxxxxxx> Cc: Jan Kara <jack@xxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/pagemap.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/include/linux/pagemap.h~page-cache-store-only-head-pages-in-i_pages-fix-fix +++ a/include/linux/pagemap.h @@ -335,12 +335,15 @@ static inline struct page *grab_cache_pa static inline struct page *find_subpage(struct page *page, pgoff_t offset) { - unsigned long index = page_index(page); + unsigned long mask; + + if (PageHuge(page)) + return page; VM_BUG_ON_PAGE(PageTail(page), page); - VM_BUG_ON_PAGE(index > offset, page); - VM_BUG_ON_PAGE(index + (1 << compound_order(page)) <= offset, page); - return page - index + offset; + + mask = (1UL << compound_order(page)) - 1; + return page + (offset & mask); } struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); _ Patches currently in -mm which might be from kirill@xxxxxxxxxxxxx are page-cache-store-only-head-pages-in-i_pages-fix-fix.patch