aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/init_32.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-13 03:49:38 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-13 03:49:38 -0500
commitb1864e9a1afef41709886072c6e6248def0386f4 (patch)
tree2fe749209cf860c1dd10efd1bd2ad8df572bd66e /arch/x86/mm/init_32.c
parente9c4ffb11f0b19005b5b9dc8481687a3637e5887 (diff)
parent7032e8696726354d6180d8a2d17191f958cd93ae (diff)
Merge branch 'x86/core' into perfcounters/core
Conflicts: arch/x86/Kconfig arch/x86/kernel/apic.c arch/x86/kernel/setup_percpu.c
Diffstat (limited to 'arch/x86/mm/init_32.c')
-rw-r--r--arch/x86/mm/init_32.c134
1 files changed, 78 insertions, 56 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 00263bf07a88..06708ee94aa4 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -674,75 +674,97 @@ static int __init parse_highmem(char *arg)
674} 674}
675early_param("highmem", parse_highmem); 675early_param("highmem", parse_highmem);
676 676
677#define MSG_HIGHMEM_TOO_BIG \
678 "highmem size (%luMB) is bigger than pages available (%luMB)!\n"
679
680#define MSG_LOWMEM_TOO_SMALL \
681 "highmem size (%luMB) results in <64MB lowmem, ignoring it!\n"
677/* 682/*
678 * Determine low and high memory ranges: 683 * All of RAM fits into lowmem - but if user wants highmem
684 * artificially via the highmem=x boot parameter then create
685 * it:
679 */ 686 */
680void __init find_low_pfn_range(void) 687void __init lowmem_pfn_init(void)
681{ 688{
682 /* it could update max_pfn */
683
684 /* max_low_pfn is 0, we already have early_res support */ 689 /* max_low_pfn is 0, we already have early_res support */
685
686 max_low_pfn = max_pfn; 690 max_low_pfn = max_pfn;
687 if (max_low_pfn > MAXMEM_PFN) { 691
688 if (highmem_pages == -1) 692 if (highmem_pages == -1)
689 highmem_pages = max_pfn - MAXMEM_PFN; 693 highmem_pages = 0;
690 if (highmem_pages + MAXMEM_PFN < max_pfn) 694#ifdef CONFIG_HIGHMEM
691 max_pfn = MAXMEM_PFN + highmem_pages; 695 if (highmem_pages >= max_pfn) {
692 if (highmem_pages + MAXMEM_PFN > max_pfn) { 696 printk(KERN_ERR MSG_HIGHMEM_TOO_BIG,
693 printk(KERN_WARNING "only %luMB highmem pages " 697 pages_to_mb(highmem_pages), pages_to_mb(max_pfn));
694 "available, ignoring highmem size of %uMB.\n", 698 highmem_pages = 0;
695 pages_to_mb(max_pfn - MAXMEM_PFN), 699 }
700 if (highmem_pages) {
701 if (max_low_pfn - highmem_pages < 64*1024*1024/PAGE_SIZE) {
702 printk(KERN_ERR MSG_LOWMEM_TOO_SMALL,
696 pages_to_mb(highmem_pages)); 703 pages_to_mb(highmem_pages));
697 highmem_pages = 0; 704 highmem_pages = 0;
698 } 705 }
699 max_low_pfn = MAXMEM_PFN; 706 max_low_pfn -= highmem_pages;
707 }
708#else
709 if (highmem_pages)
710 printk(KERN_ERR "ignoring highmem size on non-highmem kernel!\n");
711#endif
712}
713
714#define MSG_HIGHMEM_TOO_SMALL \
715 "only %luMB highmem pages available, ignoring highmem size of %luMB!\n"
716
717#define MSG_HIGHMEM_TRIMMED \
718 "Warning: only 4GB will be used. Use a HIGHMEM64G enabled kernel!\n"
719/*
720 * We have more RAM than fits into lowmem - we try to put it into
721 * highmem, also taking the highmem=x boot parameter into account:
722 */
723void __init highmem_pfn_init(void)
724{
725 max_low_pfn = MAXMEM_PFN;
726
727 if (highmem_pages == -1)
728 highmem_pages = max_pfn - MAXMEM_PFN;
729
730 if (highmem_pages + MAXMEM_PFN < max_pfn)
731 max_pfn = MAXMEM_PFN + highmem_pages;
732
733 if (highmem_pages + MAXMEM_PFN > max_pfn) {
734 printk(KERN_WARNING MSG_HIGHMEM_TOO_SMALL,
735 pages_to_mb(max_pfn - MAXMEM_PFN),
736 pages_to_mb(highmem_pages));
737 highmem_pages = 0;
738 }
700#ifndef CONFIG_HIGHMEM 739#ifndef CONFIG_HIGHMEM
701 /* Maximum memory usable is what is directly addressable */ 740 /* Maximum memory usable is what is directly addressable */
702 printk(KERN_WARNING "Warning only %ldMB will be used.\n", 741 printk(KERN_WARNING "Warning only %ldMB will be used.\n", MAXMEM>>20);
703 MAXMEM>>20); 742 if (max_pfn > MAX_NONPAE_PFN)
704 if (max_pfn > MAX_NONPAE_PFN) 743 printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
705 printk(KERN_WARNING 744 else
706 "Use a HIGHMEM64G enabled kernel.\n"); 745 printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
707 else 746 max_pfn = MAXMEM_PFN;
708 printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
709 max_pfn = MAXMEM_PFN;
710#else /* !CONFIG_HIGHMEM */ 747#else /* !CONFIG_HIGHMEM */
711#ifndef CONFIG_HIGHMEM64G 748#ifndef CONFIG_HIGHMEM64G
712 if (max_pfn > MAX_NONPAE_PFN) { 749 if (max_pfn > MAX_NONPAE_PFN) {
713 max_pfn = MAX_NONPAE_PFN; 750 max_pfn = MAX_NONPAE_PFN;
714 printk(KERN_WARNING "Warning only 4GB will be used." 751 printk(KERN_WARNING MSG_HIGHMEM_TRIMMED);
715 "Use a HIGHMEM64G enabled kernel.\n"); 752 }
716 }
717#endif /* !CONFIG_HIGHMEM64G */ 753#endif /* !CONFIG_HIGHMEM64G */
718#endif /* !CONFIG_HIGHMEM */ 754#endif /* !CONFIG_HIGHMEM */
719 } else { 755}
720 if (highmem_pages == -1) 756
721 highmem_pages = 0; 757/*
722#ifdef CONFIG_HIGHMEM 758 * Determine low and high memory ranges:
723 if (highmem_pages >= max_pfn) { 759 */
724 printk(KERN_ERR "highmem size specified (%uMB) is " 760void __init find_low_pfn_range(void)
725 "bigger than pages available (%luMB)!.\n", 761{
726 pages_to_mb(highmem_pages), 762 /* it could update max_pfn */
727 pages_to_mb(max_pfn)); 763
728 highmem_pages = 0; 764 if (max_pfn <= MAXMEM_PFN)
729 } 765 lowmem_pfn_init();
730 if (highmem_pages) { 766 else
731 if (max_low_pfn - highmem_pages < 767 highmem_pfn_init();
732 64*1024*1024/PAGE_SIZE){
733 printk(KERN_ERR "highmem size %uMB results in "
734 "smaller than 64MB lowmem, ignoring it.\n"
735 , pages_to_mb(highmem_pages));
736 highmem_pages = 0;
737 }
738 max_low_pfn -= highmem_pages;
739 }
740#else
741 if (highmem_pages)
742 printk(KERN_ERR "ignoring highmem size on non-highmem"
743 " kernel!\n");
744#endif
745 }
746} 768}
747 769
748#ifndef CONFIG_NEED_MULTIPLE_NODES 770#ifndef CONFIG_NEED_MULTIPLE_NODES