From: Nitin Gupta Date: Tue, 13 Jun 2017 22:27:17 +0000 (-0700) Subject: sparc64: Fix build errors when THP is enabled X-Git-Tag: v4.1.12-104.0.20170618_1145~23 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=540962e0d3db2c30f37532aca8293bdaf7123b00;p=users%2Fjedix%2Flinux-maple.git sparc64: Fix build errors when THP is enabled Build errors were due to a new page table level (p4d) introduced by 5-level page table patches. Orabug: 25858371 Signed-off-by: Nitin Gupta Signed-off-by: Allen Pais --- diff --git a/mm/huge_memory.c b/mm/huge_memory.c index cb6d0f1efd430..d7d33e7125a88 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1627,6 +1627,7 @@ pmd_t *page_check_address_pmd(struct page *page, spinlock_t **ptl) { pgd_t *pgd; + p4d_t *p4d; pud_t *pud; pmd_t *pmd; @@ -1636,7 +1637,10 @@ pmd_t *page_check_address_pmd(struct page *page, pgd = pgd_offset(mm, address); if (!pgd_present(*pgd)) return NULL; - pud = pud_offset(pgd, address); + p4d = p4d_offset(pgd, address); + if (!p4d_present(*p4d)) + return NULL; + pud = pud_offset(p4d, address); if (!pud_present(*pud)) return NULL; pmd = pmd_offset(pud, address); @@ -3011,6 +3015,7 @@ static void split_huge_page_address(struct mm_struct *mm, unsigned long address) { pgd_t *pgd; + p4d_t *p4d; pud_t *pud; pmd_t *pmd; @@ -3020,7 +3025,11 @@ static void split_huge_page_address(struct mm_struct *mm, if (!pgd_present(*pgd)) return; - pud = pud_offset(pgd, address); + p4d = p4d_offset(pgd, address); + if (!p4d_present(*p4d)) + return; + + pud = pud_offset(p4d, address); if (!pud_present(*pud)) return;