memblock: make memblock_set_node() support different memblock_type
authorTang Chen <tangchen@cn.fujitsu.com>
Tue, 21 Jan 2014 23:49:26 +0000 (15:49 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Jan 2014 00:19:44 +0000 (16:19 -0800)
[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>
12 files changed:
arch/metag/mm/init.c
arch/metag/mm/numa.c
arch/microblaze/mm/init.c
arch/powerpc/mm/mem.c
arch/powerpc/mm/numa.c
arch/sh/kernel/setup.c
arch/sparc/mm/init_64.c
arch/x86/mm/init_32.c
arch/x86/mm/init_64.c
arch/x86/mm/numa.c
include/linux/memblock.h
mm/memblock.c

index 3cd6288f65c22bd8c0aed5968d886363d0a9f6fb..11fa51c89617deb1a303c6bfdbf82b2a32a1e4db 100644 (file)
@@ -204,7 +204,8 @@ static void __init do_init_bootmem(void)
                start_pfn = memblock_region_memory_base_pfn(reg);
                end_pfn = memblock_region_memory_end_pfn(reg);
                memblock_set_node(PFN_PHYS(start_pfn),
-                                 PFN_PHYS(end_pfn - start_pfn), 0);
+                                 PFN_PHYS(end_pfn - start_pfn),
+                                 &memblock.memory, 0);
        }
 
        /* All of system RAM sits in node 0 for the non-NUMA case */
index b172aa45fcf8201934880a0ac41cf8461ca4a435..67b46c2950728e9e7691fccea44d9ab9656ed54f 100644 (file)
@@ -42,7 +42,8 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
        memblock_add(start, end - start);
 
        memblock_set_node(PFN_PHYS(start_pfn),
-                         PFN_PHYS(end_pfn - start_pfn), nid);
+                         PFN_PHYS(end_pfn - start_pfn),
+                         &memblock.memory, nid);
 
        /* Node-local pgdat */
        pgdat_paddr = memblock_alloc_base(sizeof(struct pglist_data),
index 74c7bcc1e82d8da05b6775274f572fe17114d5f0..89077d34671458acf121c47224674289eb84e15d 100644 (file)
@@ -192,7 +192,8 @@ void __init setup_memory(void)
                start_pfn = memblock_region_memory_base_pfn(reg);
                end_pfn = memblock_region_memory_end_pfn(reg);
                memblock_set_node(start_pfn << PAGE_SHIFT,
-                                       (end_pfn - start_pfn) << PAGE_SHIFT, 0);
+                                 (end_pfn - start_pfn) << PAGE_SHIFT,
+                                 &memblock.memory, 0);
        }
 
        /* free bootmem is whole main memory */
index 3fa93dc7fe750a9f53c875493b969f1962bea9af..8c1dd23652a13e32f0818772e62b9b2ec24539b1 100644 (file)
@@ -209,7 +209,7 @@ void __init do_init_bootmem(void)
        /* Place all memblock_regions in the same node and merge contiguous
         * memblock_regions
         */
-       memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);
+       memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
 
        /* Add all physical memory to the bootmem map, mark each area
         * present.
index 078d3e00a6168fe7d56f212c0822800ee77bc9f8..5a944f25e94ff4618661cd6efaea6ca3140157c8 100644 (file)
@@ -670,7 +670,8 @@ static void __init parse_drconf_memory(struct device_node *memory)
                        node_set_online(nid);
                        sz = numa_enforce_memory_limit(base, size);
                        if (sz)
-                               memblock_set_node(base, sz, nid);
+                               memblock_set_node(base, sz,
+                                                 &memblock.memory, nid);
                } while (--ranges);
        }
 }
@@ -760,7 +761,7 @@ new_range:
                                continue;
                }
 
-               memblock_set_node(start, size, nid);
+               memblock_set_node(start, size, &memblock.memory, nid);
 
                if (--ranges)
                        goto new_range;
@@ -797,7 +798,8 @@ static void __init setup_nonnuma(void)
 
                fake_numa_create_new_node(end_pfn, &nid);
                memblock_set_node(PFN_PHYS(start_pfn),
-                                 PFN_PHYS(end_pfn - start_pfn), nid);
+                                 PFN_PHYS(end_pfn - start_pfn),
+                                 &memblock.memory, nid);
                node_set_online(nid);
        }
 }
index 1cf90e947dbf19962bbf86d685b0d8b142331e99..de19cfa768f208708406e3350b5e9aecc92a6266 100644 (file)
@@ -230,8 +230,8 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
        pmb_bolt_mapping((unsigned long)__va(start), start, end - start,
                         PAGE_KERNEL);
 
-       memblock_set_node(PFN_PHYS(start_pfn),
-                         PFN_PHYS(end_pfn - start_pfn), nid);
+       memblock_set_node(PFN_PHYS(start_pfn), PFN_PHYS(end_pfn - start_pfn),
+                         &memblock.memory, nid);
 }
 
 void __init __weak plat_early_device_setup(void)
index 5322e530d09cf9cbbb459198a1613997c5bf9964..eafbc65c9c47f63772162d384ef55fd549d1e149 100644 (file)
@@ -1021,7 +1021,8 @@ static void __init add_node_ranges(void)
                                "start[%lx] end[%lx]\n",
                                nid, start, this_end);
 
-                       memblock_set_node(start, this_end - start, nid);
+                       memblock_set_node(start, this_end - start,
+                                         &memblock.memory, nid);
                        start = this_end;
                }
        }
@@ -1325,7 +1326,7 @@ static void __init bootmem_init_nonnuma(void)
               (top_of_ram - total_ram) >> 20);
 
        init_node_masks_nonnuma();
-       memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);
+       memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
        allocate_node_data(0);
        node_set_online(0);
 }
index 5bdc5430597cfea9056e08edb7902a098f28535c..e39504878aecd22f6688073bd3fca80f39bfd9c1 100644 (file)
@@ -665,7 +665,7 @@ void __init initmem_init(void)
        high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
 #endif
 
-       memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);
+       memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
        sparse_memory_present_with_active_regions(0);
 
 #ifdef CONFIG_FLATMEM
index 104d56a9245f1ea071009dc49e3bd25a2c48383b..f35c66c5959ac0042fbf9ff43a76cf55f89d9d0f 100644 (file)
@@ -643,7 +643,7 @@ kernel_physical_mapping_init(unsigned long start,
 #ifndef CONFIG_NUMA
 void __init initmem_init(void)
 {
-       memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);
+       memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
 }
 #endif
 
index c85da7bb6b603cf2cab624835ea2d6459958ce5b..82e079a0d36321e64e6ccbeb6be4aa9ba024137b 100644 (file)
@@ -491,7 +491,8 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
 
        for (i = 0; i < mi->nr_blks; i++) {
                struct numa_memblk *mb = &mi->blk[i];
-               memblock_set_node(mb->start, mb->end - mb->start, mb->nid);
+               memblock_set_node(mb->start, mb->end - mb->start,
+                                 &memblock.memory, mb->nid);
        }
 
        /*
@@ -565,7 +566,8 @@ static int __init numa_init(int (*init_func)(void))
        nodes_clear(node_possible_map);
        nodes_clear(node_online_map);
        memset(&numa_meminfo, 0, sizeof(numa_meminfo));
-       WARN_ON(memblock_set_node(0, ULLONG_MAX, MAX_NUMNODES));
+       WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.memory,
+                                 MAX_NUMNODES));
        numa_reset_distance();
 
        ret = init_func();
index b788faa71563cb88e90c76e17d5e7c5e5aae95c1..97480d392e40f0edc5a43c7c43c57061c717d0bc 100644 (file)
@@ -140,7 +140,8 @@ static inline void memblock_clear_region_flags(struct memblock_region *r,
 }
 
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
-int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid);
+int memblock_set_node(phys_addr_t base, phys_addr_t size,
+                     struct memblock_type *type, int nid);
 
 static inline void memblock_set_region_node(struct memblock_region *r, int nid)
 {
index 2121ec4c7fa0d83bde477bc6b761c17e3ca4b9d0..d5681008dce105ca71f0f5ba4f0d6e9b0180a746 100644 (file)
@@ -911,18 +911,18 @@ void __init_memblock __next_mem_pfn_range(int *idx, int nid,
  * memblock_set_node - set node ID on memblock regions
  * @base: base of area to set node ID for
  * @size: size of area to set node ID for
+ * @type: memblock type to set node ID for
  * @nid: node ID to set
  *
- * Set the nid of memblock memory regions in [@base,@base+@size) to @nid.
+ * Set the nid of memblock @type regions in [@base,@base+@size) to @nid.
  * Regions which cross the area boundaries are split as necessary.
  *
  * RETURNS:
  * 0 on success, -errno on failure.
  */
 int __init_memblock memblock_set_node(phys_addr_t base, phys_addr_t size,
-                                     int nid)
+                                     struct memblock_type *type, int nid)
 {
-       struct memblock_type *type = &memblock.memory;
        int start_rgn, end_rgn;
        int i, ret;