Skip to content

Commit 37db17c

Browse files
RichardWeiYangAlexander Gordeev
authored andcommitted
s390/mm: Get total ram pages from memblock
On s390, zero page's size relies on total ram pages. Since we plan to move the accounting into __free_pages_core(), totalram_pages may not represent the total usable pages on system at this point when defer_init is enabled. We can get the total usable pages from memblock directly. The size maybe not accurate due to the alignment, but enough for the calculation. Signed-off-by: Wei Yang <[email protected]> CC: Mike Rapoport (IBM) <[email protected]> CC: David Hildenbrand <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vasily Gorbik <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 7c67928 commit 37db17c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/s390/mm/init.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ EXPORT_SYMBOL(zero_page_mask);
6262

6363
static void __init setup_zero_pages(void)
6464
{
65+
unsigned long total_pages = PHYS_PFN(memblock_phys_mem_size() - memblock_reserved_size());
6566
unsigned int order;
6667
struct page *page;
6768
int i;
@@ -70,7 +71,7 @@ static void __init setup_zero_pages(void)
7071
order = 7;
7172

7273
/* Limit number of empty zero pages for small memory sizes */
73-
while (order > 2 && (totalram_pages() >> 10) < (1UL << order))
74+
while (order > 2 && (total_pages >> 10) < (1UL << order))
7475
order--;
7576

7677
empty_zero_page = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order);

0 commit comments

Comments
 (0)