From: Andrea Arcangeli <aarcange@xxxxxxxxxx> No pmd_trans_huge should ever materialize in migration ptes areas, because we split the hugepage before migration ptes are instantiated. Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx> Acked-by: Rik van Riel <riel@xxxxxxxxxx> --- diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -105,6 +105,10 @@ static inline int PageTransHuge(struct p VM_BUG_ON(PageTail(page)); return PageHead(page); } +static inline int PageTransCompound(struct page *page) +{ + return PageCompound(page); +} #else /* CONFIG_TRANSPARENT_HUGEPAGE */ #define HPAGE_PMD_SHIFT ({ BUG(); 0; }) #define HPAGE_PMD_MASK ({ BUG(); 0; }) @@ -122,6 +126,7 @@ static inline int split_huge_page(struct #define wait_split_huge_page(__anon_vma, __pmd) \ do { } while (0) #define PageTransHuge(page) 0 +#define PageTransCompound(page) 0 static inline int hugepage_madvise(unsigned long *vm_flags) { BUG_ON(0); diff --git a/mm/migrate.c b/mm/migrate.c --- a/mm/migrate.c +++ b/mm/migrate.c @@ -100,6 +100,7 @@ static int remove_migration_pte(struct p goto out; pmd = pmd_offset(pud, addr); + VM_BUG_ON(pmd_trans_huge(*pmd)); if (!pmd_present(*pmd)) goto out; @@ -556,6 +557,9 @@ static int unmap_and_move(new_page_t get /* page was freed from under us. So we are done. */ goto move_newpage; } + if (unlikely(PageTransHuge(page))) + if (unlikely(split_huge_page(page))) + goto move_newpage; /* prepare cgroup just returns 0 or -ENOMEM */ rc = -EAGAIN; @@ -816,6 +820,10 @@ static int do_move_page_to_node_array(st if (PageReserved(page) || PageKsm(page)) goto put_and_set; + if (unlikely(PageTransCompound(page))) + if (unlikely(split_huge_page(page))) + goto put_and_set; + pp->page = page; err = page_to_nid(page); -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>