Skip to content

Commit e0fc203

Browse files
x-y-zakpm00
authored andcommitted
mm: avoid VM_BUG_ON when try to map an anon large folio to zero page.
An anonymous large folio can be split into non order-0 folios, try_to_map_unused_to_zeropage() should not VM_BUG_ON compound pages but just return false. This fixes the crash when splitting anonymous large folios to non order-0 folios. Link: https://lkml.kernel.org/r/[email protected] Fixes: b1f2020 ("mm: remap unused subpages to shared zeropage when splitting isolated thp") Signed-off-by: Zi Yan <[email protected]> Acked-by: David Hildenbrand <[email protected]> Acked-by: Usama Arif <[email protected]> Cc: Barry Song <[email protected]> Cc: Domenico Cerasuolo <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Mike Rapoport (Microsoft) <[email protected]> Cc: Nico Pache <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Roman Gushchin <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Shakeel Butt <[email protected]> Cc: Yu Zhao <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent f4657e1 commit e0fc203

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mm/migrate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw,
206206
pte_t newpte;
207207
void *addr;
208208

209-
VM_BUG_ON_PAGE(PageCompound(page), page);
209+
if (PageCompound(page))
210+
return false;
210211
VM_BUG_ON_PAGE(!PageAnon(page), page);
211212
VM_BUG_ON_PAGE(!PageLocked(page), page);
212213
VM_BUG_ON_PAGE(pte_present(*pvmw->pte), page);

0 commit comments

Comments
 (0)