Commit 49a2bf73 authored by Pekka Enberg's avatar Pekka Enberg Committed by Ingo Molnar

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: default avatarPekka 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: default avatarIngo Molnar <mingo@elte.hu>
parent 4bbd4fa0
...@@ -855,24 +855,33 @@ static void __init find_early_table_space(unsigned long end, int use_pse, ...@@ -855,24 +855,33 @@ static void __init find_early_table_space(unsigned long end, int use_pse,
unsigned long extra; unsigned long extra;
extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT); extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
#ifdef CONFIG_X86_32
extra += PMD_SIZE; extra += PMD_SIZE;
#endif
ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
} else } else
ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT; ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE); tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE);
#ifdef CONFIG_X86_32
/* for fixmap */ /* for fixmap */
tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE); tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE);
#endif
/* /*
* RED-PEN putting page tables only on node 0 could * RED-PEN putting page tables only on node 0 could
* cause a hotspot and fill up ZONE_DMA. The page tables * cause a hotspot and fill up ZONE_DMA. The page tables
* need roughly 0.5KB per GB. * need roughly 0.5KB per GB.
*/ */
#ifdef CONFIG_X86_32
start = 0x7000; start = 0x7000;
table_start = find_e820_area(start, max_pfn_mapped<<PAGE_SHIFT, table_start = find_e820_area(start, max_pfn_mapped<<PAGE_SHIFT,
tables, PAGE_SIZE); tables, PAGE_SIZE);
#else /* CONFIG_X86_64 */
start = 0x8000;
table_start = find_e820_area(start, end, tables, PAGE_SIZE);
#endif
if (table_start == -1UL) if (table_start == -1UL)
panic("Cannot find space for the kernel page tables"); panic("Cannot find space for the kernel page tables");
......
...@@ -569,19 +569,33 @@ static void __init find_early_table_space(unsigned long end, int use_pse, ...@@ -569,19 +569,33 @@ static void __init find_early_table_space(unsigned long end, int use_pse,
unsigned long extra; unsigned long extra;
extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT); extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
#ifdef CONFIG_X86_32
extra += PMD_SIZE;
#endif
ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
} else } else
ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT; ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE); tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE);
#ifdef CONFIG_X86_32
/* for fixmap */
tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE);
#endif
/* /*
* RED-PEN putting page tables only on node 0 could * RED-PEN putting page tables only on node 0 could
* cause a hotspot and fill up ZONE_DMA. The page tables * cause a hotspot and fill up ZONE_DMA. The page tables
* need roughly 0.5KB per GB. * need roughly 0.5KB per GB.
*/ */
#ifdef CONFIG_X86_32
start = 0x7000;
table_start = find_e820_area(start, max_pfn_mapped<<PAGE_SHIFT,
tables, PAGE_SIZE);
#else /* CONFIG_X86_64 */
start = 0x8000; start = 0x8000;
table_start = find_e820_area(start, end, tables, PAGE_SIZE); table_start = find_e820_area(start, end, tables, PAGE_SIZE);
#endif
if (table_start == -1UL) if (table_start == -1UL)
panic("Cannot find space for the kernel page tables"); panic("Cannot find space for the kernel page tables");
......
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