diff options
author | Yinghai Lu <yinghai@kernel.org> | 2010-07-20 16:24:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-07-20 19:25:40 -0400 |
commit | b8ab9f82025adea77864115da73e70026fa4f540 (patch) | |
tree | 37d83932b99efd4aac2fccb2075a76bf0a147769 /mm | |
parent | 9aebbdb637a73a6092e1456ebb4a2df32cc1f611 (diff) |
x86,nobootmem: make alloc_bootmem_node fall back to other node when 32bit numa is used
Borislav Petkov reported his 32bit numa system has problem:
[ 0.000000] Reserving total of 4c00 pages for numa KVA remap
[ 0.000000] kva_start_pfn ~ 32800 max_low_pfn ~ 375fe
[ 0.000000] max_pfn = 238000
[ 0.000000] 8202MB HIGHMEM available.
[ 0.000000] 885MB LOWMEM available.
[ 0.000000] mapped low ram: 0 - 375fe000
[ 0.000000] low ram: 0 - 375fe000
[ 0.000000] alloc (nid=8 100000 - 7ee00000) (1000000 - ffffffff) 1000 1000 => 34e7000
[ 0.000000] alloc (nid=8 100000 - 7ee00000) (1000000 - ffffffff) 200 40 => 34c9d80
[ 0.000000] alloc (nid=0 100000 - 7ee00000) (1000000 - ffffffffffffffff) 180 40 => 34e6140
[ 0.000000] alloc (nid=1 80000000 - c7e60000) (1000000 - ffffffffffffffff) 240 40 => 80000000
[ 0.000000] BUG: unable to handle kernel paging request at 40000000
[ 0.000000] IP: [<c2c8cff1>] __alloc_memory_core_early+0x147/0x1d6
[ 0.000000] *pdpt = 0000000000000000 *pde = f000ff53f000ff00
...
[ 0.000000] Call Trace:
[ 0.000000] [<c2c8b4f8>] ? __alloc_bootmem_node+0x216/0x22f
[ 0.000000] [<c2c90c9b>] ? sparse_early_usemaps_alloc_node+0x5a/0x10b
[ 0.000000] [<c2c9149e>] ? sparse_init+0x1dc/0x499
[ 0.000000] [<c2c79118>] ? paging_init+0x168/0x1df
[ 0.000000] [<c2c780ff>] ? native_pagetable_setup_start+0xef/0x1bb
looks like it allocates too much high address for bootmem.
Try to cut limit with get_max_mapped()
Reported-by: Borislav Petkov <borislav.petkov@amd.com>
Tested-by: Conny Seidel <conny.seidel@amd.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: <stable@kernel.org> [2.6.34.x]
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/bootmem.c | 24 | ||||
-rw-r--r-- | mm/page_alloc.c | 3 |
2 files changed, 23 insertions, 4 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index 58c66cc5056a..142c84a54993 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -833,15 +833,24 @@ static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, | |||
833 | void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, | 833 | void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, |
834 | unsigned long align, unsigned long goal) | 834 | unsigned long align, unsigned long goal) |
835 | { | 835 | { |
836 | void *ptr; | ||
837 | |||
836 | if (WARN_ON_ONCE(slab_is_available())) | 838 | if (WARN_ON_ONCE(slab_is_available())) |
837 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); | 839 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); |
838 | 840 | ||
839 | #ifdef CONFIG_NO_BOOTMEM | 841 | #ifdef CONFIG_NO_BOOTMEM |
840 | return __alloc_memory_core_early(pgdat->node_id, size, align, | 842 | ptr = __alloc_memory_core_early(pgdat->node_id, size, align, |
843 | goal, -1ULL); | ||
844 | if (ptr) | ||
845 | return ptr; | ||
846 | |||
847 | ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, | ||
841 | goal, -1ULL); | 848 | goal, -1ULL); |
842 | #else | 849 | #else |
843 | return ___alloc_bootmem_node(pgdat->bdata, size, align, goal, 0); | 850 | ptr = ___alloc_bootmem_node(pgdat->bdata, size, align, goal, 0); |
844 | #endif | 851 | #endif |
852 | |||
853 | return ptr; | ||
845 | } | 854 | } |
846 | 855 | ||
847 | void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, | 856 | void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, |
@@ -977,14 +986,21 @@ void * __init __alloc_bootmem_low(unsigned long size, unsigned long align, | |||
977 | void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size, | 986 | void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size, |
978 | unsigned long align, unsigned long goal) | 987 | unsigned long align, unsigned long goal) |
979 | { | 988 | { |
989 | void *ptr; | ||
990 | |||
980 | if (WARN_ON_ONCE(slab_is_available())) | 991 | if (WARN_ON_ONCE(slab_is_available())) |
981 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); | 992 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); |
982 | 993 | ||
983 | #ifdef CONFIG_NO_BOOTMEM | 994 | #ifdef CONFIG_NO_BOOTMEM |
984 | return __alloc_memory_core_early(pgdat->node_id, size, align, | 995 | ptr = __alloc_memory_core_early(pgdat->node_id, size, align, |
996 | goal, ARCH_LOW_ADDRESS_LIMIT); | ||
997 | if (ptr) | ||
998 | return ptr; | ||
999 | ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, | ||
985 | goal, ARCH_LOW_ADDRESS_LIMIT); | 1000 | goal, ARCH_LOW_ADDRESS_LIMIT); |
986 | #else | 1001 | #else |
987 | return ___alloc_bootmem_node(pgdat->bdata, size, align, | 1002 | ptr = ___alloc_bootmem_node(pgdat->bdata, size, align, |
988 | goal, ARCH_LOW_ADDRESS_LIMIT); | 1003 | goal, ARCH_LOW_ADDRESS_LIMIT); |
989 | #endif | 1004 | #endif |
1005 | return ptr; | ||
990 | } | 1006 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 68319dd20bed..9bd339eb04c6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3634,6 +3634,9 @@ void * __init __alloc_memory_core_early(int nid, u64 size, u64 align, | |||
3634 | int i; | 3634 | int i; |
3635 | void *ptr; | 3635 | void *ptr; |
3636 | 3636 | ||
3637 | if (limit > get_max_mapped()) | ||
3638 | limit = get_max_mapped(); | ||
3639 | |||
3637 | /* need to go over early_node_map to find out good range for node */ | 3640 | /* need to go over early_node_map to find out good range for node */ |
3638 | for_each_active_range_index_in_nid(i, nid) { | 3641 | for_each_active_range_index_in_nid(i, nid) { |
3639 | u64 addr; | 3642 | u64 addr; |