2017-04-11 08:03:12

by Alexey Kardashevskiy

[permalink] [raw]
Subject: [PATCH kernel v2] 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: [email protected] # v4.9+
Signed-off-by: Alexey Kardashevskiy <[email protected]>
Acked-by: Balbir Singh <[email protected]>
---

Changes:
v2:
* instead of moving PageCompound() to the beginning, this just drops
PageHuge() and PageTransHuge()

---
arch/powerpc/mm/mmu_context_iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/mmu_context_iommu.c b/arch/powerpc/mm/mmu_context_iommu.c
index 497130c5c742..96f835cbf212 100644
--- a/arch/powerpc/mm/mmu_context_iommu.c
+++ b/arch/powerpc/mm/mmu_context_iommu.c
@@ -81,7 +81,7 @@ struct page *new_iommu_non_cma_page(struct page *page, unsigned long private,
gfp_t gfp_mask = GFP_USER;
struct page *new_page;

- if (PageHuge(page) || PageTransHuge(page) || PageCompound(page))
+ if (PageCompound(page))
return NULL;

if (PageHighMem(page))
@@ -100,7 +100,7 @@ static int mm_iommu_move_page_from_cma(struct page *page)
LIST_HEAD(cma_migrate_pages);

/* Ignore huge pages for now */
- if (PageHuge(page) || PageTransHuge(page) || PageCompound(page))
+ if (PageCompound(page))
return -EBUSY;

lru_add_drain();
--
2.11.0


2017-04-11 08:21:55

by Balbir Singh

[permalink] [raw]
Subject: Re: [PATCH kernel v2] powerpc/iommu: Do not call PageTransHuge() on tail pages

On Tue, 2017-04-11 at 17:54 +1000, Alexey Kardashevskiy wrote:
> 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: [email protected] # v4.9+
> Signed-off-by: Alexey Kardashevskiy <[email protected]>
> Acked-by: Balbir Singh <[email protected]>
> ---
>
> Changes:
> v2:
> * instead of moving PageCompound() to the beginning, this just drops
> PageHuge() and PageTransHuge()
>

Looks good! My Acked-by is already present

Balbir Singh.

2017-04-19 22:04:33

by Michael Ellerman

[permalink] [raw]
Subject: Re: [kernel,v2] powerpc/iommu: Do not call PageTransHuge() on tail pages

On Tue, 2017-04-11 at 07:54:57 UTC, Alexey Kardashevskiy wrote:
> 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: [email protected] # v4.9+
> Signed-off-by: Alexey Kardashevskiy <[email protected]>
> Acked-by: Balbir Singh <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/e889e96e98e8da97bd39e46b725361

cheers