aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/init_32.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-06-23 15:00:45 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 06:50:18 -0400
commit90d967e0ef68f5312ed4b081d5c9312ff53c1c93 (patch)
tree1708f6209d77699ed09c6a6edc057159aa5b1165 /arch/x86/mm/init_32.c
parent7f0be02c5ed1deb04c54c6a17f412e04f417df11 (diff)
x86: move find_max_low_pfn to init_32.c
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/init_32.c')
-rw-r--r--arch/x86/mm/init_32.c89
1 files changed, 88 insertions, 1 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 98080782ee47..d1017336f1b5 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -540,8 +540,95 @@ static void __init set_nx(void)
540} 540}
541#endif 541#endif
542 542
543/* user-defined highmem size */
544static unsigned int highmem_pages = -1;
545
546/*
547 * highmem=size forces highmem to be exactly 'size' bytes.
548 * This works even on boxes that have no highmem otherwise.
549 * This also works to reduce highmem size on bigger boxes.
550 */
551static int __init parse_highmem(char *arg)
552{
553 if (!arg)
554 return -EINVAL;
555
556 highmem_pages = memparse(arg, &arg) >> PAGE_SHIFT;
557 return 0;
558}
559early_param("highmem", parse_highmem);
560
561/*
562 * Determine low and high memory ranges:
563 */
564unsigned long __init find_max_low_pfn(void)
565{
566 unsigned long max_low_pfn;
567
568 max_low_pfn = max_pfn;
569 if (max_low_pfn > MAXMEM_PFN) {
570 if (highmem_pages == -1)
571 highmem_pages = max_pfn - MAXMEM_PFN;
572 if (highmem_pages + MAXMEM_PFN < max_pfn)
573 max_pfn = MAXMEM_PFN + highmem_pages;
574 if (highmem_pages + MAXMEM_PFN > max_pfn) {
575 printk(KERN_WARNING "only %luMB highmem pages "
576 "available, ignoring highmem size of %uMB.\n",
577 pages_to_mb(max_pfn - MAXMEM_PFN),
578 pages_to_mb(highmem_pages));
579 highmem_pages = 0;
580 }
581 max_low_pfn = MAXMEM_PFN;
582#ifndef CONFIG_HIGHMEM
583 /* Maximum memory usable is what is directly addressable */
584 printk(KERN_WARNING "Warning only %ldMB will be used.\n",
585 MAXMEM>>20);
586 if (max_pfn > MAX_NONPAE_PFN)
587 printk(KERN_WARNING
588 "Use a HIGHMEM64G enabled kernel.\n");
589 else
590 printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
591 max_pfn = MAXMEM_PFN;
592#else /* !CONFIG_HIGHMEM */
593#ifndef CONFIG_HIGHMEM64G
594 if (max_pfn > MAX_NONPAE_PFN) {
595 max_pfn = MAX_NONPAE_PFN;
596 printk(KERN_WARNING "Warning only 4GB will be used."
597 "Use a HIGHMEM64G enabled kernel.\n");
598 }
599#endif /* !CONFIG_HIGHMEM64G */
600#endif /* !CONFIG_HIGHMEM */
601 } else {
602 if (highmem_pages == -1)
603 highmem_pages = 0;
604#ifdef CONFIG_HIGHMEM
605 if (highmem_pages >= max_pfn) {
606 printk(KERN_ERR "highmem size specified (%uMB) is "
607 "bigger than pages available (%luMB)!.\n",
608 pages_to_mb(highmem_pages),
609 pages_to_mb(max_pfn));
610 highmem_pages = 0;
611 }
612 if (highmem_pages) {
613 if (max_low_pfn - highmem_pages <
614 64*1024*1024/PAGE_SIZE){
615 printk(KERN_ERR "highmem size %uMB results in "
616 "smaller than 64MB lowmem, ignoring it.\n"
617 , pages_to_mb(highmem_pages));
618 highmem_pages = 0;
619 }
620 max_low_pfn -= highmem_pages;
621 }
622#else
623 if (highmem_pages)
624 printk(KERN_ERR "ignoring highmem size on non-highmem"
625 " kernel!\n");
626#endif
627 }
628 return max_low_pfn;
629}
630
543#ifndef CONFIG_NEED_MULTIPLE_NODES 631#ifndef CONFIG_NEED_MULTIPLE_NODES
544extern unsigned long find_max_low_pfn(void);
545unsigned long __init initmem_init(unsigned long start_pfn, 632unsigned long __init initmem_init(unsigned long start_pfn,
546 unsigned long end_pfn) 633 unsigned long end_pfn)
547{ 634{