Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/mm: Align memory_limit value specified using mem= kernel parameter

The value specified for the memory limit is used to set a restriction on
memory usage. It is important to ensure that this restriction is within
the linear map kernel address space range. The hash page table
translation uses a 16MB page size to map the kernel linear map address
space. htab_bolt_mapping() function aligns down the size of the range
while mapping kernel linear address space. Since the memblock limit is
enforced very early during boot, before we can detect the type of memory
translation (radix vs hash), we align the memory limit value specified
as a kernel parameter to 16MB. This alignment value will work for both
hash and radix translations.

Signed-off-by: Aneesh Kumar K.V (IBM) <aneesh.kumar@kernel.org>
Acked-by: Joel Savitz <jsavitz@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240403083611.172833-1-aneesh.kumar@kernel.org

authored by

Aneesh Kumar K.V (IBM) and committed by
Michael Ellerman
5ca09616 f318c8be

+7 -4
+5 -2
arch/powerpc/kernel/prom.c
··· 846 846 reserve_crashkernel(); 847 847 early_reserve_mem(); 848 848 849 - /* Ensure that total memory size is page-aligned. */ 850 - limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE); 849 + if (memory_limit > memblock_phys_mem_size()) 850 + memory_limit = 0; 851 + 852 + /* Align down to 16 MB which is large page size with hash page translation */ 853 + limit = ALIGN_DOWN(memory_limit ?: memblock_phys_mem_size(), SZ_16M); 851 854 memblock_enforce_memory_limit(limit); 852 855 853 856 #if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_4K_PAGES)
+2 -2
arch/powerpc/kernel/prom_init.c
··· 817 817 opt += 4; 818 818 prom_memory_limit = prom_memparse(opt, (const char **)&opt); 819 819 #ifdef CONFIG_PPC64 820 - /* Align to 16 MB == size of ppc64 large page */ 821 - prom_memory_limit = ALIGN(prom_memory_limit, 0x1000000); 820 + /* Align down to 16 MB which is large page size with hash page translation */ 821 + prom_memory_limit = ALIGN_DOWN(prom_memory_limit, SZ_16M); 822 822 #endif 823 823 } 824 824