]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: convert __do_fault() to use a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 8 Nov 2023 18:28:05 +0000 (18:28 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 20 Nov 2023 21:16:29 +0000 (13:16 -0800)
commitd34086d3625978e455f874db58f1645623d3dcac
treeea4799765ea9d5b166b76892ee5119f1353d7a9c
parent37022f8ca1a1acf1397d6d8e208c06b74b4dd9a6
mm: convert __do_fault() to use a folio

Convert vmf->page to a folio as soon as we're going to use it.  This fixes
a bug if the fault handler returns a tail page with hardware poison; tail
pages have an invalid page->index, so we would fail to unmap the page from
the page tables.  We actually have to unmap the entire folio (or
mapping_evict_folio() will fail), so use unmap_mapping_folio() instead.

This also saves various calls to compound_head() hidden in lock_page(),
put_page(), etc.

Link: https://lkml.kernel.org/r/20231108182809.602073-3-willy@infradead.org
Fixes: 793917d997df ("mm/readahead: Add large folio readahead")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory.c