On Thu, Mar 16, 2017 at 06:26:53PM +0300, Kirill A. Shutemov wrote: > +static int __gup_device_huge_pmd(pmd_t pmd, unsigned long addr, > + unsigned long end, struct page **pages, int *nr) > +{ > + unsigned long fault_pfn; > + > + fault_pfn = pmd_pfn(pmd) + ((addr & ~PMD_MASK) >> PAGE_SHIFT); > + return __gup_device_huge(fault_pfn, addr, end, pages, nr); > +} > + > +static int __gup_device_huge_pud(pud_t pud, unsigned long addr, > + unsigned long end, struct page **pages, int *nr) > +{ > + unsigned long fault_pfn; > + > + fault_pfn = pud_pfn(pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT); > + return __gup_device_huge(fault_pfn, addr, end, pages, nr); > +} > + PowerPC doesn't [always] provide pmd_pfn() and pud_pfn(). Fixup: diff --git a/mm/gup.c b/mm/gup.c index 5cc489d98562..6f36cbc294cf 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1287,6 +1287,7 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end, } #endif /* __HAVE_ARCH_PTE_SPECIAL */ +#ifdef __HAVE_ARCH_PTE_DEVMAP static int __gup_device_huge(unsigned long pfn, unsigned long addr, unsigned long end, struct page **pages, int *nr) { @@ -1328,6 +1329,21 @@ static int __gup_device_huge_pud(pud_t pud, unsigned long addr, fault_pfn = pud_pfn(pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT); return __gup_device_huge(fault_pfn, addr, end, pages, nr); } +#else +static int __gup_device_huge_pmd(pmd_t pmd, unsigned long addr, + unsigned long end, struct page **pages, int *nr) +{ + BUILD_BUG(); + return 0; +} + +static int __gup_device_huge_pud(pud_t pud, unsigned long addr, + unsigned long end, struct page **pages, int *nr) +{ + BUILD_BUG(); + return 0; +} +#endif static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, unsigned long end, int write, struct page **pages, int *nr) @@ -1338,7 +1354,6 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, if (!pmd_access_permitted(orig, write)) return 0; - VM_BUG_ON(!pfn_valid(pmd_pfn(orig))); if (pmd_devmap(orig)) return __gup_device_huge_pmd(orig, addr, end, pages, nr); @@ -1378,7 +1393,6 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr, if (!pud_access_permitted(orig, write)) return 0; - VM_BUG_ON(!pfn_valid(pud_pfn(orig))); if (pud_devmap(orig)) return __gup_device_huge_pud(orig, addr, end, pages, nr); -- Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>