Commit 79612395 authored by Russell King's avatar Russell King

ARM: Precalculate vmalloc_min

Rather than storing the minimum size of the vmalloc area, store the
maximum permitted address of the vmalloc area instead.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 2f7989ef
...@@ -668,7 +668,7 @@ void __init iotable_init(struct map_desc *io_desc, int nr) ...@@ -668,7 +668,7 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
create_mapping(io_desc + i); create_mapping(io_desc + i);
} }
static unsigned long __initdata vmalloc_reserve = SZ_128M; static void * __initdata vmalloc_min = (void *)(VMALLOC_END - SZ_128M);
/* /*
* vmalloc=size forces the vmalloc area to be exactly 'size' * vmalloc=size forces the vmalloc area to be exactly 'size'
...@@ -677,7 +677,7 @@ static unsigned long __initdata vmalloc_reserve = SZ_128M; ...@@ -677,7 +677,7 @@ static unsigned long __initdata vmalloc_reserve = SZ_128M;
*/ */
static int __init early_vmalloc(char *arg) static int __init early_vmalloc(char *arg)
{ {
vmalloc_reserve = memparse(arg, NULL); unsigned long vmalloc_reserve = memparse(arg, NULL);
if (vmalloc_reserve < SZ_16M) { if (vmalloc_reserve < SZ_16M) {
vmalloc_reserve = SZ_16M; vmalloc_reserve = SZ_16M;
...@@ -692,12 +692,12 @@ static int __init early_vmalloc(char *arg) ...@@ -692,12 +692,12 @@ static int __init early_vmalloc(char *arg)
"vmalloc area is too big, limiting to %luMB\n", "vmalloc area is too big, limiting to %luMB\n",
vmalloc_reserve >> 20); vmalloc_reserve >> 20);
} }
vmalloc_min = (void *)(VMALLOC_END - vmalloc_reserve);
return 0; return 0;
} }
early_param("vmalloc", early_vmalloc); early_param("vmalloc", early_vmalloc);
#define VMALLOC_MIN (void *)(VMALLOC_END - vmalloc_reserve)
static void __init sanity_check_meminfo(void) static void __init sanity_check_meminfo(void)
{ {
int i, j, highmem = 0; int i, j, highmem = 0;
...@@ -707,7 +707,7 @@ static void __init sanity_check_meminfo(void) ...@@ -707,7 +707,7 @@ static void __init sanity_check_meminfo(void)
*bank = meminfo.bank[i]; *bank = meminfo.bank[i];
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
if (__va(bank->start) > VMALLOC_MIN || if (__va(bank->start) > vmalloc_min ||
__va(bank->start) < (void *)PAGE_OFFSET) __va(bank->start) < (void *)PAGE_OFFSET)
highmem = 1; highmem = 1;
...@@ -717,8 +717,8 @@ static void __init sanity_check_meminfo(void) ...@@ -717,8 +717,8 @@ static void __init sanity_check_meminfo(void)
* Split those memory banks which are partially overlapping * Split those memory banks which are partially overlapping
* the vmalloc area greatly simplifying things later. * the vmalloc area greatly simplifying things later.
*/ */
if (__va(bank->start) < VMALLOC_MIN && if (__va(bank->start) < vmalloc_min &&
bank->size > VMALLOC_MIN - __va(bank->start)) { bank->size > vmalloc_min - __va(bank->start)) {
if (meminfo.nr_banks >= NR_BANKS) { if (meminfo.nr_banks >= NR_BANKS) {
printk(KERN_CRIT "NR_BANKS too low, " printk(KERN_CRIT "NR_BANKS too low, "
"ignoring high memory\n"); "ignoring high memory\n");
...@@ -727,12 +727,12 @@ static void __init sanity_check_meminfo(void) ...@@ -727,12 +727,12 @@ static void __init sanity_check_meminfo(void)
(meminfo.nr_banks - i) * sizeof(*bank)); (meminfo.nr_banks - i) * sizeof(*bank));
meminfo.nr_banks++; meminfo.nr_banks++;
i++; i++;
bank[1].size -= VMALLOC_MIN - __va(bank->start); bank[1].size -= vmalloc_min - __va(bank->start);
bank[1].start = __pa(VMALLOC_MIN - 1) + 1; bank[1].start = __pa(vmalloc_min - 1) + 1;
bank[1].highmem = highmem = 1; bank[1].highmem = highmem = 1;
j++; j++;
} }
bank->size = VMALLOC_MIN - __va(bank->start); bank->size = vmalloc_min - __va(bank->start);
} }
#else #else
bank->highmem = highmem; bank->highmem = highmem;
...@@ -741,7 +741,7 @@ static void __init sanity_check_meminfo(void) ...@@ -741,7 +741,7 @@ static void __init sanity_check_meminfo(void)
* Check whether this memory bank would entirely overlap * Check whether this memory bank would entirely overlap
* the vmalloc area. * the vmalloc area.
*/ */
if (__va(bank->start) >= VMALLOC_MIN || if (__va(bank->start) >= vmalloc_min ||
__va(bank->start) < (void *)PAGE_OFFSET) { __va(bank->start) < (void *)PAGE_OFFSET) {
printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx " printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx "
"(vmalloc region overlap).\n", "(vmalloc region overlap).\n",
...@@ -753,9 +753,9 @@ static void __init sanity_check_meminfo(void) ...@@ -753,9 +753,9 @@ static void __init sanity_check_meminfo(void)
* Check whether this memory bank would partially overlap * Check whether this memory bank would partially overlap
* the vmalloc area. * the vmalloc area.
*/ */
if (__va(bank->start + bank->size) > VMALLOC_MIN || if (__va(bank->start + bank->size) > vmalloc_min ||
__va(bank->start + bank->size) < __va(bank->start)) { __va(bank->start + bank->size) < __va(bank->start)) {
unsigned long newsize = VMALLOC_MIN - __va(bank->start); unsigned long newsize = vmalloc_min - __va(bank->start);
printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx " printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx "
"to -%.8lx (vmalloc region overlap).\n", "to -%.8lx (vmalloc region overlap).\n",
bank->start, bank->start + bank->size - 1, bank->start, bank->start + bank->size - 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment