diff options
-rw-r--r-- | arch/x86/mm/numa_64.c | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 4057b5d43918..8043d5e7f0d3 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -128,14 +128,11 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) | |||
128 | 128 | ||
129 | /* Initialize bootmem allocator for a node */ | 129 | /* Initialize bootmem allocator for a node */ |
130 | void __init | 130 | void __init |
131 | setup_node_bootmem(int nodeid, unsigned long start, unsigned long end) | 131 | setup_node_bootmem(int nid, unsigned long start, unsigned long end) |
132 | { | 132 | { |
133 | unsigned long start_pfn, last_pfn, nodedata_phys; | 133 | const size_t nd_size = roundup(sizeof(pg_data_t), PAGE_SIZE); |
134 | const int pgdat_size = roundup(sizeof(pg_data_t), PAGE_SIZE); | 134 | unsigned long nd_pa; |
135 | int nid; | 135 | int tnid; |
136 | |||
137 | if (!end) | ||
138 | return; | ||
139 | 136 | ||
140 | /* | 137 | /* |
141 | * Don't confuse VM with a node that doesn't have the | 138 | * Don't confuse VM with a node that doesn't have the |
@@ -146,30 +143,27 @@ setup_node_bootmem(int nodeid, unsigned long start, unsigned long end) | |||
146 | 143 | ||
147 | start = roundup(start, ZONE_ALIGN); | 144 | start = roundup(start, ZONE_ALIGN); |
148 | 145 | ||
149 | printk(KERN_INFO "Initmem setup node %d %016lx-%016lx\n", nodeid, | 146 | printk(KERN_INFO "Initmem setup node %d %016lx-%016lx\n", |
150 | start, end); | 147 | nid, start, end); |
151 | |||
152 | start_pfn = start >> PAGE_SHIFT; | ||
153 | last_pfn = end >> PAGE_SHIFT; | ||
154 | 148 | ||
155 | node_data[nodeid] = early_node_mem(nodeid, start, end, pgdat_size, | 149 | node_data[nid] = early_node_mem(nid, start, end, nd_size, |
156 | SMP_CACHE_BYTES); | 150 | SMP_CACHE_BYTES); |
157 | if (node_data[nodeid] == NULL) | 151 | if (node_data[nid] == NULL) |
158 | return; | 152 | return; |
159 | nodedata_phys = __pa(node_data[nodeid]); | 153 | nd_pa = __pa(node_data[nid]); |
160 | memblock_x86_reserve_range(nodedata_phys, nodedata_phys + pgdat_size, "NODE_DATA"); | 154 | memblock_x86_reserve_range(nd_pa, nd_pa + nd_size, "NODE_DATA"); |
161 | printk(KERN_INFO " NODE_DATA [%016lx - %016lx]\n", nodedata_phys, | 155 | printk(KERN_INFO " NODE_DATA [%016lx - %016lx]\n", |
162 | nodedata_phys + pgdat_size - 1); | 156 | nd_pa, nd_pa + nd_size - 1); |
163 | nid = early_pfn_to_nid(nodedata_phys >> PAGE_SHIFT); | 157 | tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); |
164 | if (nid != nodeid) | 158 | if (tnid != nid) |
165 | printk(KERN_INFO " NODE_DATA(%d) on node %d\n", nodeid, nid); | 159 | printk(KERN_INFO " NODE_DATA(%d) on node %d\n", nid, tnid); |
166 | 160 | ||
167 | memset(NODE_DATA(nodeid), 0, sizeof(pg_data_t)); | 161 | memset(NODE_DATA(nid), 0, sizeof(pg_data_t)); |
168 | NODE_DATA(nodeid)->node_id = nodeid; | 162 | NODE_DATA(nid)->node_id = nid; |
169 | NODE_DATA(nodeid)->node_start_pfn = start_pfn; | 163 | NODE_DATA(nid)->node_start_pfn = start >> PAGE_SHIFT; |
170 | NODE_DATA(nodeid)->node_spanned_pages = last_pfn - start_pfn; | 164 | NODE_DATA(nid)->node_spanned_pages = (end - start) >> PAGE_SHIFT; |
171 | 165 | ||
172 | node_set_online(nodeid); | 166 | node_set_online(nid); |
173 | } | 167 | } |
174 | 168 | ||
175 | /** | 169 | /** |