aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/mmu.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-05-22 11:20:14 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-07-16 05:57:35 -0400
commit7961239599de71130c852ecfa9a4140f3f60547b (patch)
tree99f08f76ad8dfd8c671f713a3ec87769dc315632 /arch/arm/mm/mmu.c
parent2f7989efd4398d92b8adffce2e07dd043a0895fe (diff)
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: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/mmu.c')
-rw-r--r--arch/arm/mm/mmu.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 285894171186..6a08087ab022 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -668,7 +668,7 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
668 create_mapping(io_desc + i); 668 create_mapping(io_desc + i);
669} 669}
670 670
671static unsigned long __initdata vmalloc_reserve = SZ_128M; 671static void * __initdata vmalloc_min = (void *)(VMALLOC_END - SZ_128M);
672 672
673/* 673/*
674 * vmalloc=size forces the vmalloc area to be exactly 'size' 674 * vmalloc=size forces the vmalloc area to be exactly 'size'
@@ -677,7 +677,7 @@ static unsigned long __initdata vmalloc_reserve = SZ_128M;
677 */ 677 */
678static int __init early_vmalloc(char *arg) 678static int __init early_vmalloc(char *arg)
679{ 679{
680 vmalloc_reserve = memparse(arg, NULL); 680 unsigned long vmalloc_reserve = memparse(arg, NULL);
681 681
682 if (vmalloc_reserve < SZ_16M) { 682 if (vmalloc_reserve < SZ_16M) {
683 vmalloc_reserve = SZ_16M; 683 vmalloc_reserve = SZ_16M;
@@ -692,12 +692,12 @@ static int __init early_vmalloc(char *arg)
692 "vmalloc area is too big, limiting to %luMB\n", 692 "vmalloc area is too big, limiting to %luMB\n",
693 vmalloc_reserve >> 20); 693 vmalloc_reserve >> 20);
694 } 694 }
695
696 vmalloc_min = (void *)(VMALLOC_END - vmalloc_reserve);
695 return 0; 697 return 0;
696} 698}
697early_param("vmalloc", early_vmalloc); 699early_param("vmalloc", early_vmalloc);
698 700
699#define VMALLOC_MIN (void *)(VMALLOC_END - vmalloc_reserve)
700
701static void __init sanity_check_meminfo(void) 701static void __init sanity_check_meminfo(void)
702{ 702{
703 int i, j, highmem = 0; 703 int i, j, highmem = 0;
@@ -707,7 +707,7 @@ static void __init sanity_check_meminfo(void)
707 *bank = meminfo.bank[i]; 707 *bank = meminfo.bank[i];
708 708
709#ifdef CONFIG_HIGHMEM 709#ifdef CONFIG_HIGHMEM
710 if (__va(bank->start) > VMALLOC_MIN || 710 if (__va(bank->start) > vmalloc_min ||
711 __va(bank->start) < (void *)PAGE_OFFSET) 711 __va(bank->start) < (void *)PAGE_OFFSET)
712 highmem = 1; 712 highmem = 1;
713 713
@@ -717,8 +717,8 @@ static void __init sanity_check_meminfo(void)
717 * Split those memory banks which are partially overlapping 717 * Split those memory banks which are partially overlapping
718 * the vmalloc area greatly simplifying things later. 718 * the vmalloc area greatly simplifying things later.
719 */ 719 */
720 if (__va(bank->start) < VMALLOC_MIN && 720 if (__va(bank->start) < vmalloc_min &&
721 bank->size > VMALLOC_MIN - __va(bank->start)) { 721 bank->size > vmalloc_min - __va(bank->start)) {
722 if (meminfo.nr_banks >= NR_BANKS) { 722 if (meminfo.nr_banks >= NR_BANKS) {
723 printk(KERN_CRIT "NR_BANKS too low, " 723 printk(KERN_CRIT "NR_BANKS too low, "
724 "ignoring high memory\n"); 724 "ignoring high memory\n");
@@ -727,12 +727,12 @@ static void __init sanity_check_meminfo(void)
727 (meminfo.nr_banks - i) * sizeof(*bank)); 727 (meminfo.nr_banks - i) * sizeof(*bank));
728 meminfo.nr_banks++; 728 meminfo.nr_banks++;
729 i++; 729 i++;
730 bank[1].size -= VMALLOC_MIN - __va(bank->start); 730 bank[1].size -= vmalloc_min - __va(bank->start);
731 bank[1].start = __pa(VMALLOC_MIN - 1) + 1; 731 bank[1].start = __pa(vmalloc_min - 1) + 1;
732 bank[1].highmem = highmem = 1; 732 bank[1].highmem = highmem = 1;
733 j++; 733 j++;
734 } 734 }
735 bank->size = VMALLOC_MIN - __va(bank->start); 735 bank->size = vmalloc_min - __va(bank->start);
736 } 736 }
737#else 737#else
738 bank->highmem = highmem; 738 bank->highmem = highmem;
@@ -741,7 +741,7 @@ static void __init sanity_check_meminfo(void)
741 * Check whether this memory bank would entirely overlap 741 * Check whether this memory bank would entirely overlap
742 * the vmalloc area. 742 * the vmalloc area.
743 */ 743 */
744 if (__va(bank->start) >= VMALLOC_MIN || 744 if (__va(bank->start) >= vmalloc_min ||
745 __va(bank->start) < (void *)PAGE_OFFSET) { 745 __va(bank->start) < (void *)PAGE_OFFSET) {
746 printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx " 746 printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx "
747 "(vmalloc region overlap).\n", 747 "(vmalloc region overlap).\n",
@@ -753,9 +753,9 @@ static void __init sanity_check_meminfo(void)
753 * Check whether this memory bank would partially overlap 753 * Check whether this memory bank would partially overlap
754 * the vmalloc area. 754 * the vmalloc area.
755 */ 755 */
756 if (__va(bank->start + bank->size) > VMALLOC_MIN || 756 if (__va(bank->start + bank->size) > vmalloc_min ||
757 __va(bank->start + bank->size) < __va(bank->start)) { 757 __va(bank->start + bank->size) < __va(bank->start)) {
758 unsigned long newsize = VMALLOC_MIN - __va(bank->start); 758 unsigned long newsize = vmalloc_min - __va(bank->start);
759 printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx " 759 printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx "
760 "to -%.8lx (vmalloc region overlap).\n", 760 "to -%.8lx (vmalloc region overlap).\n",
761 bank->start, bank->start + bank->size - 1, 761 bank->start, bank->start + bank->size - 1,