From 90178c1900798633dd0c83ab693254b8705177c5 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Fri, 18 Sep 2020 12:25:37 +0200 Subject: s390/mm: let vmalloc area size depend on physical memory size To make sure that the vmalloc area size is for almost all cases large enough let it depend on the (potential) physical memory size. There is still the possibility to override this with the vmalloc kernel command line parameter. Reviewed-by: Christian Borntraeger Reviewed-by: Claudio Imbrenda Reviewed-by: Vasily Gorbik Signed-off-by: Heiko Carstens --- arch/s390/boot/startup.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'arch/s390/boot/startup.c') diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index cc96b04cc0ba..95d13a252ed9 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c @@ -126,6 +126,21 @@ static void clear_bss_section(void) memset((void *)vmlinux.default_lma + vmlinux.image_size, 0, vmlinux.bss_size); } +/* + * Set vmalloc area size to an 8th of (potential) physical memory + * size, unless size has been set by kernel command line parameter. + */ +static void setup_vmalloc_size(void) +{ + unsigned long size; + + if (vmalloc_size_set) + return; + size = (memory_end ?: max_physmem_end) >> 3; + size = round_up(size, _SEGMENT_SIZE); + vmalloc_size = max(size, vmalloc_size); +} + void startup_kernel(void) { unsigned long random_lma; @@ -142,6 +157,7 @@ void startup_kernel(void) parse_boot_command_line(); setup_memory_end(); detect_memory(); + setup_vmalloc_size(); random_lma = __kaslr_offset = 0; if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && kaslr_enabled) { -- cgit v1.2.3-59-g8ed1b