aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2009-03-05 07:54:54 -0500
committerIngo Molnar <mingo@elte.hu>2009-03-05 08:17:11 -0500
commit49a2bf7303b0dc5fccbb3ff7cf2e7751f0e3953d (patch)
tree00d72cbbe8e048e586c1cee24f6e832b0d306e86 /arch/x86/mm
parent4bbd4fa03832208f0e6e0b9e73a0ffa2620a626a (diff)
x86: find_early_table_space() unification
Impact: cleanup There are some minor differences between the 32-bit and 64-bit find_early_table_space() functions. This patch wraps those differences under CONFIG_X86_32 to make the function identical on both configurations. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <1236257708-27269-3-git-send-email-penberg@cs.helsinki.fi> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/init_32.c9
-rw-r--r--arch/x86/mm/init_64.c14
2 files changed, 23 insertions, 0 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 5fad0f95d5a3..86a99947455b 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -855,24 +855,33 @@ static void __init find_early_table_space(unsigned long end, int use_pse,
855 unsigned long extra; 855 unsigned long extra;
856 856
857 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT); 857 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
858#ifdef CONFIG_X86_32
858 extra += PMD_SIZE; 859 extra += PMD_SIZE;
860#endif
859 ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; 861 ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
860 } else 862 } else
861 ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT; 863 ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
862 864
863 tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE); 865 tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE);
864 866
867#ifdef CONFIG_X86_32
865 /* for fixmap */ 868 /* for fixmap */
866 tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE); 869 tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE);
870#endif
867 871
868 /* 872 /*
869 * RED-PEN putting page tables only on node 0 could 873 * RED-PEN putting page tables only on node 0 could
870 * cause a hotspot and fill up ZONE_DMA. The page tables 874 * cause a hotspot and fill up ZONE_DMA. The page tables
871 * need roughly 0.5KB per GB. 875 * need roughly 0.5KB per GB.
872 */ 876 */
877#ifdef CONFIG_X86_32
873 start = 0x7000; 878 start = 0x7000;
874 table_start = find_e820_area(start, max_pfn_mapped<<PAGE_SHIFT, 879 table_start = find_e820_area(start, max_pfn_mapped<<PAGE_SHIFT,
875 tables, PAGE_SIZE); 880 tables, PAGE_SIZE);
881#else /* CONFIG_X86_64 */
882 start = 0x8000;
883 table_start = find_e820_area(start, end, tables, PAGE_SIZE);
884#endif
876 if (table_start == -1UL) 885 if (table_start == -1UL)
877 panic("Cannot find space for the kernel page tables"); 886 panic("Cannot find space for the kernel page tables");
878 887
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index cdb3be1c41f1..151e5ba34412 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -569,19 +569,33 @@ static void __init find_early_table_space(unsigned long end, int use_pse,
569 unsigned long extra; 569 unsigned long extra;
570 570
571 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT); 571 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
572#ifdef CONFIG_X86_32
573 extra += PMD_SIZE;
574#endif
572 ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; 575 ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
573 } else 576 } else
574 ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT; 577 ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
575 578
576 tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE); 579 tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE);
577 580
581#ifdef CONFIG_X86_32
582 /* for fixmap */
583 tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE);
584#endif
585
578 /* 586 /*
579 * RED-PEN putting page tables only on node 0 could 587 * RED-PEN putting page tables only on node 0 could
580 * cause a hotspot and fill up ZONE_DMA. The page tables 588 * cause a hotspot and fill up ZONE_DMA. The page tables
581 * need roughly 0.5KB per GB. 589 * need roughly 0.5KB per GB.
582 */ 590 */
591#ifdef CONFIG_X86_32
592 start = 0x7000;
593 table_start = find_e820_area(start, max_pfn_mapped<<PAGE_SHIFT,
594 tables, PAGE_SIZE);
595#else /* CONFIG_X86_64 */
583 start = 0x8000; 596 start = 0x8000;
584 table_start = find_e820_area(start, end, tables, PAGE_SIZE); 597 table_start = find_e820_area(start, end, tables, PAGE_SIZE);
598#endif
585 if (table_start == -1UL) 599 if (table_start == -1UL)
586 panic("Cannot find space for the kernel page tables"); 600 panic("Cannot find space for the kernel page tables");
587 601