aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexander Gordeev <agordeev@linux.ibm.com> 2023-07-11 07:58:24 +0200
committerGravatar Alexander Gordeev <agordeev@linux.ibm.com> 2024-04-17 13:37:59 +0200
commitecf74da64defe9e7f1862d86b4f3d4041e22dc4a (patch)
treefc819e6a7ecd4fa26b481e3ee82597eb4a494440
parents390/boot: Consider DCSS segments on memory layout setup (diff)
downloadlinux-ecf74da64defe9e7f1862d86b4f3d4041e22dc4a.tar.gz
linux-ecf74da64defe9e7f1862d86b4f3d4041e22dc4a.tar.bz2
linux-ecf74da64defe9e7f1862d86b4f3d4041e22dc4a.zip
s390/boot: Reduce size of identity mapping on overlap
In case vmemmap array could overlap with vmalloc area on virtual memory layout setup, the size of vmalloc area is decreased. That could result in less memory than user requested with vmalloc= kernel command line parameter. Instead, reduce the size of identity mapping (and the size of vmemmap array as result) to avoid such overlap. Further, currently the virtual memmory allocation "rolls" from top to bottom and it is only VMALLOC_START that could get increased due to the overlap. Change that to decrease- only, which makes the whole allocation algorithm more easy to comprehend. Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-rw-r--r--arch/s390/boot/startup.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c
index eee742b88cc8..069ecc81332f 100644
--- a/arch/s390/boot/startup.c
+++ b/arch/s390/boot/startup.c
@@ -318,7 +318,10 @@ static unsigned long setup_kernel_memory_layout(void)
ident_map_size = min(ident_map_size, vmemmap_start);
vmemmap_size = SECTION_ALIGN_UP(ident_map_size / PAGE_SIZE) * sizeof(struct page);
/* make sure vmemmap doesn't overlay with vmalloc area */
- VMALLOC_START = max(vmemmap_start + vmemmap_size, VMALLOC_START);
+ if (vmemmap_start + vmemmap_size > VMALLOC_START) {
+ vmemmap_size = SECTION_ALIGN_DOWN(ident_map_size / PAGE_SIZE) * sizeof(struct page);
+ ident_map_size = vmemmap_size / sizeof(struct page) * PAGE_SIZE;
+ }
vmemmap = (struct page *)vmemmap_start;
/* maximum address for which linear mapping could be created (DCSS, memory) */
BUILD_BUG_ON(MAX_DCSS_ADDR > (1UL << MAX_PHYSMEM_BITS));