aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTang Chen <tangchen@cn.fujitsu.com>2014-01-21 18:49:26 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 19:19:44 -0500
commite7e8de5918dd6a07cbddae559600d7765ad6a56e (patch)
treee0db7a05cdf156fc3f5a6312ce6629866f8ac47e
parent66b16edf9eafc3291cabb2253d0f342a847656b7 (diff)
memblock: make memblock_set_node() support different memblock_type
[sfr@canb.auug.org.au: fix powerpc build] Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: "Rafael J . Wysocki" <rjw@sisk.pl> Cc: Chen Tang <imtangchen@gmail.com> Cc: Gong Chen <gong.chen@linux.intel.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jiang Liu <jiang.liu@huawei.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Larry Woodman <lwoodman@redhat.com> Cc: Len Brown <lenb@kernel.org> Cc: Liu Jiang <jiang.liu@huawei.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Michal Nazarewicz <mina86@mina86.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Prarit Bhargava <prarit@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Taku Izumi <izumi.taku@jp.fujitsu.com> Cc: Tejun Heo <tj@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Thomas Renninger <trenn@suse.de> Cc: Toshi Kani <toshi.kani@hp.com> Cc: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com> Cc: Wen Congyang <wency@cn.fujitsu.com> Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Cc: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/metag/mm/init.c3
-rw-r--r--arch/metag/mm/numa.c3
-rw-r--r--arch/microblaze/mm/init.c3
-rw-r--r--arch/powerpc/mm/mem.c2
-rw-r--r--arch/powerpc/mm/numa.c8
-rw-r--r--arch/sh/kernel/setup.c4
-rw-r--r--arch/sparc/mm/init_64.c5
-rw-r--r--arch/x86/mm/init_32.c2
-rw-r--r--arch/x86/mm/init_64.c2
-rw-r--r--arch/x86/mm/numa.c6
-rw-r--r--include/linux/memblock.h3
-rw-r--r--mm/memblock.c6
12 files changed, 28 insertions, 19 deletions
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index 3cd6288f65c2..11fa51c89617 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -204,7 +204,8 @@ static void __init do_init_bootmem(void)
204 start_pfn = memblock_region_memory_base_pfn(reg); 204 start_pfn = memblock_region_memory_base_pfn(reg);
205 end_pfn = memblock_region_memory_end_pfn(reg); 205 end_pfn = memblock_region_memory_end_pfn(reg);
206 memblock_set_node(PFN_PHYS(start_pfn), 206 memblock_set_node(PFN_PHYS(start_pfn),
207 PFN_PHYS(end_pfn - start_pfn), 0); 207 PFN_PHYS(end_pfn - start_pfn),
208 &memblock.memory, 0);
208 } 209 }
209 210
210 /* All of system RAM sits in node 0 for the non-NUMA case */ 211 /* All of system RAM sits in node 0 for the non-NUMA case */
diff --git a/arch/metag/mm/numa.c b/arch/metag/mm/numa.c
index b172aa45fcf8..67b46c295072 100644
--- a/arch/metag/mm/numa.c
+++ b/arch/metag/mm/numa.c
@@ -42,7 +42,8 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
42 memblock_add(start, end - start); 42 memblock_add(start, end - start);
43 43
44 memblock_set_node(PFN_PHYS(start_pfn), 44 memblock_set_node(PFN_PHYS(start_pfn),
45 PFN_PHYS(end_pfn - start_pfn), nid); 45 PFN_PHYS(end_pfn - start_pfn),
46 &memblock.memory, nid);
46 47
47 /* Node-local pgdat */ 48 /* Node-local pgdat */
48 pgdat_paddr = memblock_alloc_base(sizeof(struct pglist_data), 49 pgdat_paddr = memblock_alloc_base(sizeof(struct pglist_data),
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index 74c7bcc1e82d..89077d346714 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -192,7 +192,8 @@ void __init setup_memory(void)
192 start_pfn = memblock_region_memory_base_pfn(reg); 192 start_pfn = memblock_region_memory_base_pfn(reg);
193 end_pfn = memblock_region_memory_end_pfn(reg); 193 end_pfn = memblock_region_memory_end_pfn(reg);
194 memblock_set_node(start_pfn << PAGE_SHIFT, 194 memblock_set_node(start_pfn << PAGE_SHIFT,
195 (end_pfn - start_pfn) << PAGE_SHIFT, 0); 195 (end_pfn - start_pfn) << PAGE_SHIFT,
196 &memblock.memory, 0);
196 } 197 }
197 198
198 /* free bootmem is whole main memory */ 199 /* free bootmem is whole main memory */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 3fa93dc7fe75..8c1dd23652a1 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -209,7 +209,7 @@ void __init do_init_bootmem(void)
209 /* Place all memblock_regions in the same node and merge contiguous 209 /* Place all memblock_regions in the same node and merge contiguous
210 * memblock_regions 210 * memblock_regions
211 */ 211 */
212 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 212 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
213 213
214 /* Add all physical memory to the bootmem map, mark each area 214 /* Add all physical memory to the bootmem map, mark each area
215 * present. 215 * present.
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 078d3e00a616..5a944f25e94f 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -670,7 +670,8 @@ static void __init parse_drconf_memory(struct device_node *memory)
670 node_set_online(nid); 670 node_set_online(nid);
671 sz = numa_enforce_memory_limit(base, size); 671 sz = numa_enforce_memory_limit(base, size);
672 if (sz) 672 if (sz)
673 memblock_set_node(base, sz, nid); 673 memblock_set_node(base, sz,
674 &memblock.memory, nid);
674 } while (--ranges); 675 } while (--ranges);
675 } 676 }
676} 677}
@@ -760,7 +761,7 @@ new_range:
760 continue; 761 continue;
761 } 762 }
762 763
763 memblock_set_node(start, size, nid); 764 memblock_set_node(start, size, &memblock.memory, nid);
764 765
765 if (--ranges) 766 if (--ranges)
766 goto new_range; 767 goto new_range;
@@ -797,7 +798,8 @@ static void __init setup_nonnuma(void)
797 798
798 fake_numa_create_new_node(end_pfn, &nid); 799 fake_numa_create_new_node(end_pfn, &nid);
799 memblock_set_node(PFN_PHYS(start_pfn), 800 memblock_set_node(PFN_PHYS(start_pfn),
800 PFN_PHYS(end_pfn - start_pfn), nid); 801 PFN_PHYS(end_pfn - start_pfn),
802 &memblock.memory, nid);
801 node_set_online(nid); 803 node_set_online(nid);
802 } 804 }
803} 805}
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 1cf90e947dbf..de19cfa768f2 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -230,8 +230,8 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
230 pmb_bolt_mapping((unsigned long)__va(start), start, end - start, 230 pmb_bolt_mapping((unsigned long)__va(start), start, end - start,
231 PAGE_KERNEL); 231 PAGE_KERNEL);
232 232
233 memblock_set_node(PFN_PHYS(start_pfn), 233 memblock_set_node(PFN_PHYS(start_pfn), PFN_PHYS(end_pfn - start_pfn),
234 PFN_PHYS(end_pfn - start_pfn), nid); 234 &memblock.memory, nid);
235} 235}
236 236
237void __init __weak plat_early_device_setup(void) 237void __init __weak plat_early_device_setup(void)
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 5322e530d09c..eafbc65c9c47 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1021,7 +1021,8 @@ static void __init add_node_ranges(void)
1021 "start[%lx] end[%lx]\n", 1021 "start[%lx] end[%lx]\n",
1022 nid, start, this_end); 1022 nid, start, this_end);
1023 1023
1024 memblock_set_node(start, this_end - start, nid); 1024 memblock_set_node(start, this_end - start,
1025 &memblock.memory, nid);
1025 start = this_end; 1026 start = this_end;
1026 } 1027 }
1027 } 1028 }
@@ -1325,7 +1326,7 @@ static void __init bootmem_init_nonnuma(void)
1325 (top_of_ram - total_ram) >> 20); 1326 (top_of_ram - total_ram) >> 20);
1326 1327
1327 init_node_masks_nonnuma(); 1328 init_node_masks_nonnuma();
1328 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 1329 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
1329 allocate_node_data(0); 1330 allocate_node_data(0);
1330 node_set_online(0); 1331 node_set_online(0);
1331} 1332}
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 5bdc5430597c..e39504878aec 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -665,7 +665,7 @@ void __init initmem_init(void)
665 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; 665 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
666#endif 666#endif
667 667
668 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 668 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
669 sparse_memory_present_with_active_regions(0); 669 sparse_memory_present_with_active_regions(0);
670 670
671#ifdef CONFIG_FLATMEM 671#ifdef CONFIG_FLATMEM
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 104d56a9245f..f35c66c5959a 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -643,7 +643,7 @@ kernel_physical_mapping_init(unsigned long start,
643#ifndef CONFIG_NUMA 643#ifndef CONFIG_NUMA
644void __init initmem_init(void) 644void __init initmem_init(void)
645{ 645{
646 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 646 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
647} 647}
648#endif 648#endif
649 649
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index c85da7bb6b60..82e079a0d363 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -491,7 +491,8 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
491 491
492 for (i = 0; i < mi->nr_blks; i++) { 492 for (i = 0; i < mi->nr_blks; i++) {
493 struct numa_memblk *mb = &mi->blk[i]; 493 struct numa_memblk *mb = &mi->blk[i];
494 memblock_set_node(mb->start, mb->end - mb->start, mb->nid); 494 memblock_set_node(mb->start, mb->end - mb->start,
495 &memblock.memory, mb->nid);
495 } 496 }
496 497
497 /* 498 /*
@@ -565,7 +566,8 @@ static int __init numa_init(int (*init_func)(void))
565 nodes_clear(node_possible_map); 566 nodes_clear(node_possible_map);
566 nodes_clear(node_online_map); 567 nodes_clear(node_online_map);
567 memset(&numa_meminfo, 0, sizeof(numa_meminfo)); 568 memset(&numa_meminfo, 0, sizeof(numa_meminfo));
568 WARN_ON(memblock_set_node(0, ULLONG_MAX, MAX_NUMNODES)); 569 WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.memory,
570 MAX_NUMNODES));
569 numa_reset_distance(); 571 numa_reset_distance();
570 572
571 ret = init_func(); 573 ret = init_func();
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index b788faa71563..97480d392e40 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -140,7 +140,8 @@ static inline void memblock_clear_region_flags(struct memblock_region *r,
140} 140}
141 141
142#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 142#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
143int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid); 143int memblock_set_node(phys_addr_t base, phys_addr_t size,
144 struct memblock_type *type, int nid);
144 145
145static inline void memblock_set_region_node(struct memblock_region *r, int nid) 146static inline void memblock_set_region_node(struct memblock_region *r, int nid)
146{ 147{
diff --git a/mm/memblock.c b/mm/memblock.c
index 2121ec4c7fa0..d5681008dce1 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -911,18 +911,18 @@ void __init_memblock __next_mem_pfn_range(int *idx, int nid,
911 * memblock_set_node - set node ID on memblock regions 911 * memblock_set_node - set node ID on memblock regions
912 * @base: base of area to set node ID for 912 * @base: base of area to set node ID for
913 * @size: size of area to set node ID for 913 * @size: size of area to set node ID for
914 * @type: memblock type to set node ID for
914 * @nid: node ID to set 915 * @nid: node ID to set
915 * 916 *
916 * Set the nid of memblock memory regions in [@base,@base+@size) to @nid. 917 * Set the nid of memblock @type regions in [@base,@base+@size) to @nid.
917 * Regions which cross the area boundaries are split as necessary. 918 * Regions which cross the area boundaries are split as necessary.
918 * 919 *
919 * RETURNS: 920 * RETURNS:
920 * 0 on success, -errno on failure. 921 * 0 on success, -errno on failure.
921 */ 922 */
922int __init_memblock memblock_set_node(phys_addr_t base, phys_addr_t size, 923int __init_memblock memblock_set_node(phys_addr_t base, phys_addr_t size,
923 int nid) 924 struct memblock_type *type, int nid)
924{ 925{
925 struct memblock_type *type = &memblock.memory;
926 int start_rgn, end_rgn; 926 int start_rgn, end_rgn;
927 int i, ret; 927 int i, ret;
928 928