2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-29 15:43:59 +08:00

sparc64: Cleanup hugepage table walk functions

Flatten out nested code structure in huge_pte_offset()
and huge_pte_alloc().

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Nitin Gupta 2017-07-29 11:42:19 -07:00 committed by David S. Miller
parent f10bb00790
commit 7637978474

View File

@ -266,27 +266,19 @@ pte_t *huge_pte_alloc(struct mm_struct *mm,
pgd_t *pgd; pgd_t *pgd;
pud_t *pud; pud_t *pud;
pmd_t *pmd; pmd_t *pmd;
pte_t *pte = NULL;
pgd = pgd_offset(mm, addr); pgd = pgd_offset(mm, addr);
pud = pud_alloc(mm, pgd, addr); pud = pud_alloc(mm, pgd, addr);
if (!pud) if (!pud)
return NULL; return NULL;
if (sz >= PUD_SIZE) if (sz >= PUD_SIZE)
pte = (pte_t *)pud; return (pte_t *)pud;
else { pmd = pmd_alloc(mm, pud, addr);
pmd = pmd_alloc(mm, pud, addr); if (!pmd)
if (!pmd) return NULL;
return NULL; if (sz >= PMD_SIZE)
return (pte_t *)pmd;
if (sz >= PMD_SIZE) return pte_alloc_map(mm, pmd, addr);
pte = (pte_t *)pmd;
else
pte = pte_alloc_map(mm, pmd, addr);
}
return pte;
} }
pte_t *huge_pte_offset(struct mm_struct *mm, pte_t *huge_pte_offset(struct mm_struct *mm,
@ -295,27 +287,21 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
pgd_t *pgd; pgd_t *pgd;
pud_t *pud; pud_t *pud;
pmd_t *pmd; pmd_t *pmd;
pte_t *pte = NULL;
pgd = pgd_offset(mm, addr); pgd = pgd_offset(mm, addr);
if (!pgd_none(*pgd)) { if (pgd_none(*pgd))
pud = pud_offset(pgd, addr); return NULL;
if (!pud_none(*pud)) { pud = pud_offset(pgd, addr);
if (is_hugetlb_pud(*pud)) if (pud_none(*pud))
pte = (pte_t *)pud; return NULL;
else { if (is_hugetlb_pud(*pud))
pmd = pmd_offset(pud, addr); return (pte_t *)pud;
if (!pmd_none(*pmd)) { pmd = pmd_offset(pud, addr);
if (is_hugetlb_pmd(*pmd)) if (pmd_none(*pmd))
pte = (pte_t *)pmd; return NULL;
else if (is_hugetlb_pmd(*pmd))
pte = pte_offset_map(pmd, addr); return (pte_t *)pmd;
} return pte_offset_map(pmd, addr);
}
}
}
return pte;
} }
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,