s390/vmalloc: have separate modules area
Add a special module area on top of the vmalloc area, which may be only used for modules and bpf jit generated code. This makes sure that inter module branches will always happen without a trampoline and in addition having all the code within a 2GB frame is branch prediction unit friendly. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:

committed by
Martin Schwidefsky

parent
021d48be48
commit
c972cc60c2
@@ -105,6 +105,11 @@ EXPORT_SYMBOL(VMALLOC_END);
|
||||
struct page *vmemmap;
|
||||
EXPORT_SYMBOL(vmemmap);
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
unsigned long MODULES_VADDR;
|
||||
unsigned long MODULES_END;
|
||||
#endif
|
||||
|
||||
/* An array with a pointer to the lowcore of every CPU. */
|
||||
struct _lowcore *lowcore_ptr[NR_CPUS];
|
||||
EXPORT_SYMBOL(lowcore_ptr);
|
||||
@@ -544,19 +549,23 @@ static void __init setup_memory_end(void)
|
||||
|
||||
/* Choose kernel address space layout: 2, 3, or 4 levels. */
|
||||
#ifdef CONFIG_64BIT
|
||||
vmalloc_size = VMALLOC_END ?: 128UL << 30;
|
||||
vmalloc_size = VMALLOC_END ?: (128UL << 30) - MODULES_LEN;
|
||||
tmp = (memory_end ?: real_memory_size) / PAGE_SIZE;
|
||||
tmp = tmp * (sizeof(struct page) + PAGE_SIZE) + vmalloc_size;
|
||||
if (tmp <= (1UL << 42))
|
||||
vmax = 1UL << 42; /* 3-level kernel page table */
|
||||
else
|
||||
vmax = 1UL << 53; /* 4-level kernel page table */
|
||||
/* module area is at the end of the kernel address space. */
|
||||
MODULES_END = vmax;
|
||||
MODULES_VADDR = MODULES_END - MODULES_LEN;
|
||||
VMALLOC_END = MODULES_VADDR;
|
||||
#else
|
||||
vmalloc_size = VMALLOC_END ?: 96UL << 20;
|
||||
vmax = 1UL << 31; /* 2-level kernel page table */
|
||||
#endif
|
||||
/* vmalloc area is at the end of the kernel address space. */
|
||||
VMALLOC_END = vmax;
|
||||
#endif
|
||||
VMALLOC_START = vmax - vmalloc_size;
|
||||
|
||||
/* Split remaining virtual space between 1:1 mapping & vmemmap array */
|
||||
|
Reference in New Issue
Block a user