summaryrefslogtreecommitdiff
path: root/mm/fadvise.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2020-10-13 16:51:44 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-10-13 18:38:29 -0700
commit27a83a609b3b39b0a4ec6c75050b1183d7c302db (patch)
treeb962741062e1d757a4793b3834b43283c1d3b5c4 /mm/fadvise.c
parenta8cf7f272b5a28a62ecfc39d6f7d75b4f486e350 (diff)
mm/filemap: fix filemap_map_pages for THP
We dereference page->mapping and page->index directly after calling find_subpage() and these fields are not valid for tail pages. While commit 4101196b19d7 ("mm: page cache: store only head pages in i_pages") 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. 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@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: William Kucharski <william.kucharski@oracle.com> Link: https://lkml.kernel.org/r/20200911012532.24761-1-willy@infradead.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/fadvise.c')
0 files changed, 0 insertions, 0 deletions