diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-31 15:34:58 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-31 15:34:58 -0500 |
commit | 86579dd06deecfa6ac88d5e84e4d63c397cd6f6d (patch) | |
tree | b4475d3ccde53015ad84a06e4e55e64591171b75 /arch/x86_64/mm/numa.c | |
parent | 7ea9ea832212c4a755650f7c7cc1ff0b63292a41 (diff) | |
parent | a0f067802576d4eb4c65d40b8ee7d6ea3c81dd61 (diff) |
Merge branch 'master'
Diffstat (limited to 'arch/x86_64/mm/numa.c')
-rw-r--r-- | arch/x86_64/mm/numa.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c index 22e51beee8d3..4be82d6e2b48 100644 --- a/arch/x86_64/mm/numa.c +++ b/arch/x86_64/mm/numa.c | |||
@@ -25,8 +25,7 @@ | |||
25 | struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; | 25 | struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; |
26 | bootmem_data_t plat_node_bdata[MAX_NUMNODES]; | 26 | bootmem_data_t plat_node_bdata[MAX_NUMNODES]; |
27 | 27 | ||
28 | int memnode_shift; | 28 | struct memnode memnode; |
29 | u8 memnodemap[NODEMAPSIZE]; | ||
30 | 29 | ||
31 | unsigned char cpu_to_node[NR_CPUS] __read_mostly = { | 30 | unsigned char cpu_to_node[NR_CPUS] __read_mostly = { |
32 | [0 ... NR_CPUS-1] = NUMA_NO_NODE | 31 | [0 ... NR_CPUS-1] = NUMA_NO_NODE |
@@ -47,7 +46,7 @@ int numa_off __initdata; | |||
47 | * -1 if node overlap or lost ram (shift too big) | 46 | * -1 if node overlap or lost ram (shift too big) |
48 | */ | 47 | */ |
49 | static int __init | 48 | static int __init |
50 | populate_memnodemap(const struct node *nodes, int numnodes, int shift) | 49 | populate_memnodemap(const struct bootnode *nodes, int numnodes, int shift) |
51 | { | 50 | { |
52 | int i; | 51 | int i; |
53 | int res = -1; | 52 | int res = -1; |
@@ -74,7 +73,7 @@ populate_memnodemap(const struct node *nodes, int numnodes, int shift) | |||
74 | return res; | 73 | return res; |
75 | } | 74 | } |
76 | 75 | ||
77 | int __init compute_hash_shift(struct node *nodes, int numnodes) | 76 | int __init compute_hash_shift(struct bootnode *nodes, int numnodes) |
78 | { | 77 | { |
79 | int shift = 20; | 78 | int shift = 20; |
80 | 79 | ||
@@ -149,7 +148,7 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long en | |||
149 | /* Initialize final allocator for a zone */ | 148 | /* Initialize final allocator for a zone */ |
150 | void __init setup_node_zones(int nodeid) | 149 | void __init setup_node_zones(int nodeid) |
151 | { | 150 | { |
152 | unsigned long start_pfn, end_pfn; | 151 | unsigned long start_pfn, end_pfn, memmapsize, limit; |
153 | unsigned long zones[MAX_NR_ZONES]; | 152 | unsigned long zones[MAX_NR_ZONES]; |
154 | unsigned long holes[MAX_NR_ZONES]; | 153 | unsigned long holes[MAX_NR_ZONES]; |
155 | 154 | ||
@@ -159,6 +158,16 @@ void __init setup_node_zones(int nodeid) | |||
159 | Dprintk(KERN_INFO "Setting up node %d %lx-%lx\n", | 158 | Dprintk(KERN_INFO "Setting up node %d %lx-%lx\n", |
160 | nodeid, start_pfn, end_pfn); | 159 | nodeid, start_pfn, end_pfn); |
161 | 160 | ||
161 | /* Try to allocate mem_map at end to not fill up precious <4GB | ||
162 | memory. */ | ||
163 | memmapsize = sizeof(struct page) * (end_pfn-start_pfn); | ||
164 | limit = end_pfn << PAGE_SHIFT; | ||
165 | NODE_DATA(nodeid)->node_mem_map = | ||
166 | __alloc_bootmem_core(NODE_DATA(nodeid)->bdata, | ||
167 | memmapsize, SMP_CACHE_BYTES, | ||
168 | round_down(limit - memmapsize, PAGE_SIZE), | ||
169 | limit); | ||
170 | |||
162 | size_zones(zones, holes, start_pfn, end_pfn); | 171 | size_zones(zones, holes, start_pfn, end_pfn); |
163 | free_area_init_node(nodeid, NODE_DATA(nodeid), zones, | 172 | free_area_init_node(nodeid, NODE_DATA(nodeid), zones, |
164 | start_pfn, holes); | 173 | start_pfn, holes); |
@@ -191,7 +200,7 @@ int numa_fake __initdata = 0; | |||
191 | static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn) | 200 | static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn) |
192 | { | 201 | { |
193 | int i; | 202 | int i; |
194 | struct node nodes[MAX_NUMNODES]; | 203 | struct bootnode nodes[MAX_NUMNODES]; |
195 | unsigned long sz = ((end_pfn - start_pfn)<<PAGE_SHIFT) / numa_fake; | 204 | unsigned long sz = ((end_pfn - start_pfn)<<PAGE_SHIFT) / numa_fake; |
196 | 205 | ||
197 | /* Kludge needed for the hash function */ | 206 | /* Kludge needed for the hash function */ |
@@ -357,8 +366,7 @@ void __init init_cpu_to_node(void) | |||
357 | 366 | ||
358 | EXPORT_SYMBOL(cpu_to_node); | 367 | EXPORT_SYMBOL(cpu_to_node); |
359 | EXPORT_SYMBOL(node_to_cpumask); | 368 | EXPORT_SYMBOL(node_to_cpumask); |
360 | EXPORT_SYMBOL(memnode_shift); | 369 | EXPORT_SYMBOL(memnode); |
361 | EXPORT_SYMBOL(memnodemap); | ||
362 | EXPORT_SYMBOL(node_data); | 370 | EXPORT_SYMBOL(node_data); |
363 | 371 | ||
364 | #ifdef CONFIG_DISCONTIGMEM | 372 | #ifdef CONFIG_DISCONTIGMEM |
@@ -369,21 +377,6 @@ EXPORT_SYMBOL(node_data); | |||
369 | * Should do that. | 377 | * Should do that. |
370 | */ | 378 | */ |
371 | 379 | ||
372 | /* Requires pfn_valid(pfn) to be true */ | ||
373 | struct page *pfn_to_page(unsigned long pfn) | ||
374 | { | ||
375 | int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT); | ||
376 | return (pfn - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map; | ||
377 | } | ||
378 | EXPORT_SYMBOL(pfn_to_page); | ||
379 | |||
380 | unsigned long page_to_pfn(struct page *page) | ||
381 | { | ||
382 | return (long)(((page) - page_zone(page)->zone_mem_map) + | ||
383 | page_zone(page)->zone_start_pfn); | ||
384 | } | ||
385 | EXPORT_SYMBOL(page_to_pfn); | ||
386 | |||
387 | int pfn_valid(unsigned long pfn) | 380 | int pfn_valid(unsigned long pfn) |
388 | { | 381 | { |
389 | unsigned nid; | 382 | unsigned nid; |