The patch titled Subject: page-cache-store-only-head-pages-in-i_pages-fix has been added to the -mm tree. Its filename is page-cache-store-only-head-pages-in-i_pages-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.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/page-cache-store-only-head-pages-in-i_pages-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: Matthew Wilcox <willy@xxxxxxxxxxxxx> Subject: page-cache-store-only-head-pages-in-i_pages-fix Qian Cai reports that page-cache-store-only-head-pages-in-i_pages.patch fails for swapcache pages. This is because page->index has a different meaning for swapcache pages. Fix by using page_index(page) instead of page->index. Suggested by Kirill Shutemov. Link: http://lkml.kernel.org/r/20190324155441.GF10344@xxxxxxxxxxxxxxxxxxxxxx Cc: 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> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/pagemap.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/include/linux/pagemap.h~page-cache-store-only-head-pages-in-i_pages-fix +++ a/include/linux/pagemap.h @@ -335,11 +335,12 @@ 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); + VM_BUG_ON_PAGE(PageTail(page), page); - VM_BUG_ON_PAGE(page->index > offset, page); - VM_BUG_ON_PAGE(page->index + (1 << compound_order(page)) <= offset, - page); - return page - page->index + offset; + VM_BUG_ON_PAGE(index > offset, page); + VM_BUG_ON_PAGE(index + (1 << compound_order(page)) <= offset, page); + return page - index + offset; } struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); _ Patches currently in -mm which might be from willy@xxxxxxxxxxxxx are page-cache-store-only-head-pages-in-i_pages.patch page-cache-store-only-head-pages-in-i_pages-fix.patch