Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/iommu: Do not call PageTransHuge() on tail pages

The CMA pages migration code does not support compound pages at
the moment so it performs few tests before proceeding to actual page
migration.

One of the tests - PageTransHuge() - has VM_BUG_ON_PAGE(PageTail()) as
it is designed to be called on head pages only. Since we also test for
PageCompound(), and it contains PageTail() and PageHead(), we can
simplify the check by leaving just PageCompound() and therefore avoid
possible VM_BUG_ON_PAGE.

Fixes: 2e5bbb5461f1 ("KVM: PPC: Book3S HV: Migrate pinned pages out of CMA")
Cc: stable@vger.kernel.org # v4.9+
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Alexey Kardashevskiy and committed by
Michael Ellerman
e889e96e 321f7d29

+2 -2
+2 -2
arch/powerpc/mm/mmu_context_iommu.c
··· 81 81 gfp_t gfp_mask = GFP_USER; 82 82 struct page *new_page; 83 83 84 - if (PageHuge(page) || PageTransHuge(page) || PageCompound(page)) 84 + if (PageCompound(page)) 85 85 return NULL; 86 86 87 87 if (PageHighMem(page)) ··· 100 100 LIST_HEAD(cma_migrate_pages); 101 101 102 102 /* Ignore huge pages for now */ 103 - if (PageHuge(page) || PageTransHuge(page) || PageCompound(page)) 103 + if (PageCompound(page)) 104 104 return -EBUSY; 105 105 106 106 lru_add_drain();