Skip to content

Commit df8ee57

Browse files
Pavel Tatashintorvalds
authored andcommitted
sparc64: simplify vmemmap_populate
Remove duplicating code by using common functions vmemmap_pud_populate and vmemmap_pgd_populate. Link: http://lkml.kernel.org/r/[email protected] 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]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 2a20aa1 commit df8ee57

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

arch/sparc/mm/init_64.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,30 +2644,19 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend,
26442644
vstart = vstart & PMD_MASK;
26452645
vend = ALIGN(vend, PMD_SIZE);
26462646
for (; vstart < vend; vstart += PMD_SIZE) {
2647-
pgd_t *pgd = pgd_offset_k(vstart);
2647+
pgd_t *pgd = vmemmap_pgd_populate(vstart, node);
26482648
unsigned long pte;
26492649
pud_t *pud;
26502650
pmd_t *pmd;
26512651

2652-
if (pgd_none(*pgd)) {
2653-
pud_t *new = vmemmap_alloc_block(PAGE_SIZE, node);
2652+
if (!pgd)
2653+
return -ENOMEM;
26542654

2655-
if (!new)
2656-
return -ENOMEM;
2657-
pgd_populate(&init_mm, pgd, new);
2658-
}
2659-
2660-
pud = pud_offset(pgd, vstart);
2661-
if (pud_none(*pud)) {
2662-
pmd_t *new = vmemmap_alloc_block(PAGE_SIZE, node);
2663-
2664-
if (!new)
2665-
return -ENOMEM;
2666-
pud_populate(&init_mm, pud, new);
2667-
}
2655+
pud = vmemmap_pud_populate(pgd, vstart, node);
2656+
if (!pud)
2657+
return -ENOMEM;
26682658

26692659
pmd = pmd_offset(pud, vstart);
2670-
26712660
pte = pmd_val(*pmd);
26722661
if (!(pte & _PAGE_VALID)) {
26732662
void *block = vmemmap_alloc_block(PMD_SIZE, node);

0 commit comments

Comments
 (0)