diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-10-29 13:06:17 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-10-29 13:06:17 -0400 |
commit | 657e12fd388899502d47f9f6f9d276ec9ced8add (patch) | |
tree | cce20de56800ea3b63159e8db69577e761f4e094 | |
parent | c06e004c72aa0d1acbc239fb995aa3d823543a8a (diff) |
ARM: Fix sparsemem with SPARSEMEM_EXTREME enabled
When SPARSEMEM_EXTREME is enabled, memory_present() wants to use bootmem
to allocate data structures. However, we call memory_present() after
declaring memory to bootmem, but before we've reserved areas.
This leads to sparsemem data structures being overwritten later in the
kernel's initialization (when slab initializes.)
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mm/init.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 40940d7ce4ff..52c40d155672 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -273,7 +273,6 @@ static void __init bootmem_init_node(int node, struct meminfo *mi, | |||
273 | struct membank *bank = &mi->bank[i]; | 273 | struct membank *bank = &mi->bank[i]; |
274 | if (!bank->highmem) | 274 | if (!bank->highmem) |
275 | free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); | 275 | free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); |
276 | memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank)); | ||
277 | } | 276 | } |
278 | 277 | ||
279 | /* | 278 | /* |
@@ -370,6 +369,19 @@ int pfn_valid(unsigned long pfn) | |||
370 | return 0; | 369 | return 0; |
371 | } | 370 | } |
372 | EXPORT_SYMBOL(pfn_valid); | 371 | EXPORT_SYMBOL(pfn_valid); |
372 | |||
373 | static void arm_memory_present(struct meminfo *mi, int node) | ||
374 | { | ||
375 | } | ||
376 | #else | ||
377 | static void arm_memory_present(struct meminfo *mi, int node) | ||
378 | { | ||
379 | int i; | ||
380 | for_each_nodebank(i, mi, node) { | ||
381 | struct membank *bank = &mi->bank[i]; | ||
382 | memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank)); | ||
383 | } | ||
384 | } | ||
373 | #endif | 385 | #endif |
374 | 386 | ||
375 | static int __init meminfo_cmp(const void *_a, const void *_b) | 387 | static int __init meminfo_cmp(const void *_a, const void *_b) |
@@ -427,6 +439,12 @@ void __init bootmem_init(void) | |||
427 | */ | 439 | */ |
428 | if (node == initrd_node) | 440 | if (node == initrd_node) |
429 | bootmem_reserve_initrd(node); | 441 | bootmem_reserve_initrd(node); |
442 | |||
443 | /* | ||
444 | * Sparsemem tries to allocate bootmem in memory_present(), | ||
445 | * so must be done after the fixed reservations | ||
446 | */ | ||
447 | arm_memory_present(mi, node); | ||
430 | } | 448 | } |
431 | 449 | ||
432 | /* | 450 | /* |