diff options
-rw-r--r-- | arch/sparc/mm/init_64.c | 16 | ||||
-rw-r--r-- | include/linux/memblock.h | 7 | ||||
-rw-r--r-- | mm/memblock.c | 13 |
3 files changed, 19 insertions, 17 deletions
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index dd68025ecdbe..0883113624b9 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -785,8 +785,7 @@ static int find_node(unsigned long addr) | |||
785 | return -1; | 785 | return -1; |
786 | } | 786 | } |
787 | 787 | ||
788 | static unsigned long long nid_range(unsigned long long start, | 788 | u64 memblock_nid_range(u64 start, u64 end, int *nid) |
789 | unsigned long long end, int *nid) | ||
790 | { | 789 | { |
791 | *nid = find_node(start); | 790 | *nid = find_node(start); |
792 | start += PAGE_SIZE; | 791 | start += PAGE_SIZE; |
@@ -804,8 +803,7 @@ static unsigned long long nid_range(unsigned long long start, | |||
804 | return start; | 803 | return start; |
805 | } | 804 | } |
806 | #else | 805 | #else |
807 | static unsigned long long nid_range(unsigned long long start, | 806 | u64 memblock_nid_range(u64 start, u64 end, int *nid) |
808 | unsigned long long end, int *nid) | ||
809 | { | 807 | { |
810 | *nid = 0; | 808 | *nid = 0; |
811 | return end; | 809 | return end; |
@@ -822,8 +820,7 @@ static void __init allocate_node_data(int nid) | |||
822 | struct pglist_data *p; | 820 | struct pglist_data *p; |
823 | 821 | ||
824 | #ifdef CONFIG_NEED_MULTIPLE_NODES | 822 | #ifdef CONFIG_NEED_MULTIPLE_NODES |
825 | paddr = memblock_alloc_nid(sizeof(struct pglist_data), | 823 | paddr = memblock_alloc_nid(sizeof(struct pglist_data), SMP_CACHE_BYTES, nid); |
826 | SMP_CACHE_BYTES, nid, nid_range); | ||
827 | if (!paddr) { | 824 | if (!paddr) { |
828 | prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid); | 825 | prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid); |
829 | prom_halt(); | 826 | prom_halt(); |
@@ -843,8 +840,7 @@ static void __init allocate_node_data(int nid) | |||
843 | if (p->node_spanned_pages) { | 840 | if (p->node_spanned_pages) { |
844 | num_pages = bootmem_bootmap_pages(p->node_spanned_pages); | 841 | num_pages = bootmem_bootmap_pages(p->node_spanned_pages); |
845 | 842 | ||
846 | paddr = memblock_alloc_nid(num_pages << PAGE_SHIFT, PAGE_SIZE, nid, | 843 | paddr = memblock_alloc_nid(num_pages << PAGE_SHIFT, PAGE_SIZE, nid); |
847 | nid_range); | ||
848 | if (!paddr) { | 844 | if (!paddr) { |
849 | prom_printf("Cannot allocate bootmap for nid[%d]\n", | 845 | prom_printf("Cannot allocate bootmap for nid[%d]\n", |
850 | nid); | 846 | nid); |
@@ -984,7 +980,7 @@ static void __init add_node_ranges(void) | |||
984 | unsigned long this_end; | 980 | unsigned long this_end; |
985 | int nid; | 981 | int nid; |
986 | 982 | ||
987 | this_end = nid_range(start, end, &nid); | 983 | this_end = memblock_nid_range(start, end, &nid); |
988 | 984 | ||
989 | numadbg("Adding active range nid[%d] " | 985 | numadbg("Adding active range nid[%d] " |
990 | "start[%lx] end[%lx]\n", | 986 | "start[%lx] end[%lx]\n", |
@@ -1317,7 +1313,7 @@ static void __init reserve_range_in_node(int nid, unsigned long start, | |||
1317 | unsigned long this_end; | 1313 | unsigned long this_end; |
1318 | int n; | 1314 | int n; |
1319 | 1315 | ||
1320 | this_end = nid_range(start, end, &n); | 1316 | this_end = memblock_nid_range(start, end, &n); |
1321 | if (n == nid) { | 1317 | if (n == nid) { |
1322 | numadbg(" MATCH reserving range [%lx:%lx]\n", | 1318 | numadbg(" MATCH reserving range [%lx:%lx]\n", |
1323 | start, this_end); | 1319 | start, this_end); |
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 776c7d945dcc..367dea6e95a0 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h | |||
@@ -46,8 +46,7 @@ extern long memblock_add(u64 base, u64 size); | |||
46 | extern long memblock_remove(u64 base, u64 size); | 46 | extern long memblock_remove(u64 base, u64 size); |
47 | extern long __init memblock_free(u64 base, u64 size); | 47 | extern long __init memblock_free(u64 base, u64 size); |
48 | extern long __init memblock_reserve(u64 base, u64 size); | 48 | extern long __init memblock_reserve(u64 base, u64 size); |
49 | extern u64 __init memblock_alloc_nid(u64 size, u64 align, int nid, | 49 | extern u64 __init memblock_alloc_nid(u64 size, u64 align, int nid); |
50 | u64 (*nid_range)(u64, u64, int *)); | ||
51 | extern u64 __init memblock_alloc(u64 size, u64 align); | 50 | extern u64 __init memblock_alloc(u64 size, u64 align); |
52 | extern u64 __init memblock_alloc_base(u64 size, | 51 | extern u64 __init memblock_alloc_base(u64 size, |
53 | u64, u64 max_addr); | 52 | u64, u64 max_addr); |
@@ -63,6 +62,10 @@ extern int memblock_is_region_reserved(u64 base, u64 size); | |||
63 | 62 | ||
64 | extern void memblock_dump_all(void); | 63 | extern void memblock_dump_all(void); |
65 | 64 | ||
65 | /* Provided by the architecture */ | ||
66 | extern u64 memblock_nid_range(u64 start, u64 end, int *nid); | ||
67 | |||
68 | |||
66 | /* | 69 | /* |
67 | * pfn conversion functions | 70 | * pfn conversion functions |
68 | * | 71 | * |
diff --git a/mm/memblock.c b/mm/memblock.c index 8a118b71cbec..13807f280ada 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -319,7 +319,6 @@ static u64 __init memblock_alloc_nid_unreserved(u64 start, u64 end, | |||
319 | } | 319 | } |
320 | 320 | ||
321 | static u64 __init memblock_alloc_nid_region(struct memblock_region *mp, | 321 | static u64 __init memblock_alloc_nid_region(struct memblock_region *mp, |
322 | u64 (*nid_range)(u64, u64, int *), | ||
323 | u64 size, u64 align, int nid) | 322 | u64 size, u64 align, int nid) |
324 | { | 323 | { |
325 | u64 start, end; | 324 | u64 start, end; |
@@ -332,7 +331,7 @@ static u64 __init memblock_alloc_nid_region(struct memblock_region *mp, | |||
332 | u64 this_end; | 331 | u64 this_end; |
333 | int this_nid; | 332 | int this_nid; |
334 | 333 | ||
335 | this_end = nid_range(start, end, &this_nid); | 334 | this_end = memblock_nid_range(start, end, &this_nid); |
336 | if (this_nid == nid) { | 335 | if (this_nid == nid) { |
337 | u64 ret = memblock_alloc_nid_unreserved(start, this_end, | 336 | u64 ret = memblock_alloc_nid_unreserved(start, this_end, |
338 | size, align); | 337 | size, align); |
@@ -345,8 +344,7 @@ static u64 __init memblock_alloc_nid_region(struct memblock_region *mp, | |||
345 | return ~(u64)0; | 344 | return ~(u64)0; |
346 | } | 345 | } |
347 | 346 | ||
348 | u64 __init memblock_alloc_nid(u64 size, u64 align, int nid, | 347 | u64 __init memblock_alloc_nid(u64 size, u64 align, int nid) |
349 | u64 (*nid_range)(u64 start, u64 end, int *nid)) | ||
350 | { | 348 | { |
351 | struct memblock_type *mem = &memblock.memory; | 349 | struct memblock_type *mem = &memblock.memory; |
352 | int i; | 350 | int i; |
@@ -357,7 +355,6 @@ u64 __init memblock_alloc_nid(u64 size, u64 align, int nid, | |||
357 | 355 | ||
358 | for (i = 0; i < mem->cnt; i++) { | 356 | for (i = 0; i < mem->cnt; i++) { |
359 | u64 ret = memblock_alloc_nid_region(&mem->regions[i], | 357 | u64 ret = memblock_alloc_nid_region(&mem->regions[i], |
360 | nid_range, | ||
361 | size, align, nid); | 358 | size, align, nid); |
362 | if (ret != ~(u64)0) | 359 | if (ret != ~(u64)0) |
363 | return ret; | 360 | return ret; |
@@ -531,3 +528,9 @@ int memblock_is_region_reserved(u64 base, u64 size) | |||
531 | return memblock_overlaps_region(&memblock.reserved, base, size) >= 0; | 528 | return memblock_overlaps_region(&memblock.reserved, base, size) >= 0; |
532 | } | 529 | } |
533 | 530 | ||
531 | u64 __weak memblock_nid_range(u64 start, u64 end, int *nid) | ||
532 | { | ||
533 | *nid = 0; | ||
534 | |||
535 | return end; | ||
536 | } | ||