On Fri, Sep 11, 2020 at 02:25:32AM +0100, Matthew Wilcox (Oracle) wrote: > We dereference page->mapping and page->index directly after calling > find_subpage() and these fields are not valid for tail pages. While > commit 4101196b19d7 introduced the call to find_subpage(), the problem > existed prior to this; I'm going to suggest all the way back to when > THPs first existed. When hugetmpfs made upstream. > The user-visible effects of this are almost negligible. To hit it, you > have to mmap a tmpfs file at an unaligned address and then it's only > a disabled optimisation causing page faults to happen more frequently > than they otherwise would. > > Fix this by keeping both head and page pointers and checking the > appropriate one. We could use page_mapping() and page_to_index(), > but that's higher overhead. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> -- Kirill A. Shutemov