summaryrefslogtreecommitdiffstats
path: root/arch/s390/mm/init.c
diff options
context:
space:
mode:
authorWei Yang <richard.weiyang@gmail.com>2024-06-16 03:35:37 +0200
committerAlexander Gordeev <agordeev@linux.ibm.com>2024-06-24 11:12:39 +0200
commit37db17c1008c84f972da1ddd7bb10248670e6aa3 (patch)
tree301aaa7675226e9e2e1d7bd8613f533c42d0abdd /arch/s390/mm/init.c
parents390: Provide optimized __arch_hweight*() implementations (diff)
downloadlinux-37db17c1008c84f972da1ddd7bb10248670e6aa3.tar.xz
linux-37db17c1008c84f972da1ddd7bb10248670e6aa3.zip
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 <richard.weiyang@gmail.com> CC: Mike Rapoport (IBM) <rppt@kernel.org> CC: David Hildenbrand <david@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Link: https://lore.kernel.org/r/20240616013537.20338-1-richard.weiyang@gmail.com Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Diffstat (limited to 'arch/s390/mm/init.c')
-rw-r--r--arch/s390/mm/init.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index e769d2726f4e..ddcd39ef4346 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -62,6 +62,7 @@ EXPORT_SYMBOL(zero_page_mask);
static void __init setup_zero_pages(void)
{
+ unsigned long total_pages = PHYS_PFN(memblock_phys_mem_size() - memblock_reserved_size());
unsigned int order;
struct page *page;
int i;
@@ -70,7 +71,7 @@ static void __init setup_zero_pages(void)
order = 7;
/* Limit number of empty zero pages for small memory sizes */
- while (order > 2 && (totalram_pages() >> 10) < (1UL << order))
+ while (order > 2 && (total_pages >> 10) < (1UL << order))
order--;
empty_zero_page = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order);