Skip to content

Commit 54ccf66

Browse files
rpptakpm00
authored andcommitted
s390: make setup_zero_pages() use memblock
Allocating the zero pages from memblock is simpler because the memory is already reserved. This will also help with pulling out memblock_free_all() to the generic code and reducing code duplication in arch::mem_init(). Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport (Microsoft) <[email protected]> Acked-by: Heiko Carstens <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Andreas Larsson <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Borislav Betkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David S. Miller <[email protected]> Cc: Dinh Nguyen <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Guo Ren (csky) <[email protected]> Cc: Helge Deller <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiaxun Yang <[email protected]> Cc: Johannes Berg <[email protected]> Cc: John Paul Adrian Glaubitz <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Mark Brown <[email protected]> Cc: Matt Turner <[email protected]> Cc: Max Filippov <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Simek <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Russel King <[email protected]> Cc: Stafford Horne <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Thomas Gleinxer <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent be971f9 commit 54ccf66

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

arch/s390/mm/init.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ static void __init setup_zero_pages(void)
7373
{
7474
unsigned long total_pages = memblock_estimated_nr_free_pages();
7575
unsigned int order;
76-
struct page *page;
77-
int i;
7876

7977
/* Latest machines require a mapping granularity of 512KB */
8078
order = 7;
@@ -83,16 +81,7 @@ static void __init setup_zero_pages(void)
8381
while (order > 2 && (total_pages >> 10) < (1UL << order))
8482
order--;
8583

86-
empty_zero_page = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
87-
if (!empty_zero_page)
88-
panic("Out of memory in setup_zero_pages");
89-
90-
page = virt_to_page((void *) empty_zero_page);
91-
split_page(page, order);
92-
for (i = 1 << order; i > 0; i--) {
93-
mark_page_reserved(page);
94-
page++;
95-
}
84+
empty_zero_page = (unsigned long)memblock_alloc_or_panic(PAGE_SIZE << order, PAGE_SIZE);
9685

9786
zero_page_mask = ((PAGE_SIZE << order) - 1) & PAGE_MASK;
9887
}
@@ -176,9 +165,10 @@ void __init mem_init(void)
176165
pv_init();
177166
kfence_split_mapping();
178167

168+
setup_zero_pages(); /* Setup zeroed pages. */
169+
179170
/* this will put all low memory onto the freelists */
180171
memblock_free_all();
181-
setup_zero_pages(); /* Setup zeroed pages. */
182172
}
183173

184174
unsigned long memory_block_size_bytes(void)

0 commit comments

Comments
 (0)