sparc64: simplify vmemmap_populate
PATCH 84/131 sparc64: simplify vmemmap_populate
From: Pavel Tatashin <[email protected]>
Subject: sparc64: simplify vmemmap_populate
Remove duplicating code by using common functions vmemmap_pud_populate and vmemmap_pgd_populate.
Signed-off-by Pavel Tatashin <[email protected]>
Reviewed-by Steven Sistare <[email protected]>
Reviewed-by Daniel Jordan <[email protected]>
Reviewed-by Bob Picco <[email protected]>
Acked-by David S. Miller <[email protected]>
Acked-by Michal Hocko <[email protected]>
Cc Alexander Potapenko <[email protected]>
Cc Andrey Ryabinin <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Will Deacon <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
arch/sparc/mm/init_64.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
arch/sparc/mm/init_64.c renamed from arch/sparc/mm/init_64.c~sparc64-simplify-vmemmap_populate +6 -16
@@ -2644,30 +2644,19 @@ int __meminit vmemmap_populate(unsigned vstart = vstart &PMD_MASK ; vend =ALIGN (vend,PMD_SIZE );for (; vstart < vend; vstart +=PMD_SIZE ) { -pgd_t *pgd =pgd_offset_k (vstart); +pgd_t *pgd =vmemmap_pgd_populate (vstart, node);unsigned long pte;pud_t *pud;pmd_t *pmd; -if (pgd_none (*pgd)) { -pud_t *new =vmemmap_alloc_block (PAGE_SIZE , node); +if (!pgd) +return -ENOMEM ; -if (!new) -return -ENOMEM ; -pgd_populate (&init_mm, pgd, new); - } - - pud =pud_offset (pgd, vstart); -if (pud_none (*pud)) { -pmd_t *new =vmemmap_alloc_block (PAGE_SIZE , node); - -if (!new) -return -ENOMEM ; -pud_populate (&init_mm, pud, new); - } + pud =vmemmap_pud_populate (pgd, vstart, node); +if (!pud) +return -ENOMEM ; pmd =pmd_offset (pud, vstart);