aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYasunori Goto <y-goto@jp.fujitsu.com>2007-05-08 03:23:07 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:14:57 -0400
commita3142c8e1dd57ff48040bdb3478cff9312543dc3 (patch)
tree14beeb03421338b917a956e9269a2ce95e0f62cf
parent0ceb331433e8aad9c5f441a965d7c681f8b9046f (diff)
Fix section mismatch of memory hotplug related code.
This is to fix many section mismatches of code related to memory hotplug. I checked compile with memory hotplug on/off on ia64 and x86-64 box. Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/ia64/mm/discontig.c2
-rw-r--r--arch/x86_64/mm/init.c6
-rw-r--r--drivers/acpi/numa.c4
-rw-r--r--mm/page_alloc.c26
-rw-r--r--mm/sparse.c10
5 files changed, 26 insertions, 22 deletions
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 872da7a2accd..94844442812a 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -693,6 +693,7 @@ void __init paging_init(void)
693 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page)); 693 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
694} 694}
695 695
696#ifdef CONFIG_MEMORY_HOTPLUG
696pg_data_t *arch_alloc_nodedata(int nid) 697pg_data_t *arch_alloc_nodedata(int nid)
697{ 698{
698 unsigned long size = compute_pernodesize(nid); 699 unsigned long size = compute_pernodesize(nid);
@@ -710,3 +711,4 @@ void arch_refresh_nodedata(int update_node, pg_data_t *update_pgdat)
710 pgdat_list[update_node] = update_pgdat; 711 pgdat_list[update_node] = update_pgdat;
711 scatter_node_data(); 712 scatter_node_data();
712} 713}
714#endif
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index c0822683b916..1336da8bdee1 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -172,7 +172,7 @@ __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
172 set_pte_phys(address, phys, prot); 172 set_pte_phys(address, phys, prot);
173} 173}
174 174
175unsigned long __initdata table_start, table_end; 175unsigned long __meminitdata table_start, table_end;
176 176
177static __meminit void *alloc_low_page(unsigned long *phys) 177static __meminit void *alloc_low_page(unsigned long *phys)
178{ 178{
@@ -204,7 +204,7 @@ static __meminit void unmap_low_page(void *adr)
204} 204}
205 205
206/* Must run before zap_low_mappings */ 206/* Must run before zap_low_mappings */
207__init void *early_ioremap(unsigned long addr, unsigned long size) 207__meminit void *early_ioremap(unsigned long addr, unsigned long size)
208{ 208{
209 unsigned long vaddr; 209 unsigned long vaddr;
210 pmd_t *pmd, *last_pmd; 210 pmd_t *pmd, *last_pmd;
@@ -233,7 +233,7 @@ __init void *early_ioremap(unsigned long addr, unsigned long size)
233} 233}
234 234
235/* To avoid virtual aliases later */ 235/* To avoid virtual aliases later */
236__init void early_iounmap(void *addr, unsigned long size) 236__meminit void early_iounmap(void *addr, unsigned long size)
237{ 237{
238 unsigned long vaddr; 238 unsigned long vaddr;
239 pmd_t *pmd; 239 pmd_t *pmd;
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 8fcd6a15517f..4dd0dabe81cb 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -228,7 +228,7 @@ int __init acpi_numa_init(void)
228 return 0; 228 return 0;
229} 229}
230 230
231int acpi_get_pxm(acpi_handle h) 231int __meminit acpi_get_pxm(acpi_handle h)
232{ 232{
233 unsigned long pxm; 233 unsigned long pxm;
234 acpi_status status; 234 acpi_status status;
@@ -246,7 +246,7 @@ int acpi_get_pxm(acpi_handle h)
246} 246}
247EXPORT_SYMBOL(acpi_get_pxm); 247EXPORT_SYMBOL(acpi_get_pxm);
248 248
249int acpi_get_node(acpi_handle *handle) 249int __meminit acpi_get_node(acpi_handle *handle)
250{ 250{
251 int pxm, node = -1; 251 int pxm, node = -1;
252 252
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 59164313167f..fd7745111e16 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -103,7 +103,7 @@ int min_free_kbytes = 1024;
103 103
104unsigned long __meminitdata nr_kernel_pages; 104unsigned long __meminitdata nr_kernel_pages;
105unsigned long __meminitdata nr_all_pages; 105unsigned long __meminitdata nr_all_pages;
106static unsigned long __initdata dma_reserve; 106static unsigned long __meminitdata dma_reserve;
107 107
108#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 108#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
109 /* 109 /*
@@ -126,10 +126,10 @@ static unsigned long __initdata dma_reserve;
126 #endif 126 #endif
127 #endif 127 #endif
128 128
129 struct node_active_region __initdata early_node_map[MAX_ACTIVE_REGIONS]; 129 struct node_active_region __meminitdata early_node_map[MAX_ACTIVE_REGIONS];
130 int __initdata nr_nodemap_entries; 130 int __meminitdata nr_nodemap_entries;
131 unsigned long __initdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES]; 131 unsigned long __meminitdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES];
132 unsigned long __initdata arch_zone_highest_possible_pfn[MAX_NR_ZONES]; 132 unsigned long __meminitdata arch_zone_highest_possible_pfn[MAX_NR_ZONES];
133#ifdef CONFIG_MEMORY_HOTPLUG_RESERVE 133#ifdef CONFIG_MEMORY_HOTPLUG_RESERVE
134 unsigned long __initdata node_boundary_start_pfn[MAX_NUMNODES]; 134 unsigned long __initdata node_boundary_start_pfn[MAX_NUMNODES];
135 unsigned long __initdata node_boundary_end_pfn[MAX_NUMNODES]; 135 unsigned long __initdata node_boundary_end_pfn[MAX_NUMNODES];
@@ -2267,7 +2267,7 @@ __meminit int init_currently_empty_zone(struct zone *zone,
2267 * Basic iterator support. Return the first range of PFNs for a node 2267 * Basic iterator support. Return the first range of PFNs for a node
2268 * Note: nid == MAX_NUMNODES returns first region regardless of node 2268 * Note: nid == MAX_NUMNODES returns first region regardless of node
2269 */ 2269 */
2270static int __init first_active_region_index_in_nid(int nid) 2270static int __meminit first_active_region_index_in_nid(int nid)
2271{ 2271{
2272 int i; 2272 int i;
2273 2273
@@ -2282,7 +2282,7 @@ static int __init first_active_region_index_in_nid(int nid)
2282 * Basic iterator support. Return the next active range of PFNs for a node 2282 * Basic iterator support. Return the next active range of PFNs for a node
2283 * Note: nid == MAX_NUMNODES returns next region regardles of node 2283 * Note: nid == MAX_NUMNODES returns next region regardles of node
2284 */ 2284 */
2285static int __init next_active_region_index_in_nid(int index, int nid) 2285static int __meminit next_active_region_index_in_nid(int index, int nid)
2286{ 2286{
2287 for (index = index + 1; index < nr_nodemap_entries; index++) 2287 for (index = index + 1; index < nr_nodemap_entries; index++)
2288 if (nid == MAX_NUMNODES || early_node_map[index].nid == nid) 2288 if (nid == MAX_NUMNODES || early_node_map[index].nid == nid)
@@ -2435,7 +2435,7 @@ static void __init account_node_boundary(unsigned int nid,
2435 * with no available memory, a warning is printed and the start and end 2435 * with no available memory, a warning is printed and the start and end
2436 * PFNs will be 0. 2436 * PFNs will be 0.
2437 */ 2437 */
2438void __init get_pfn_range_for_nid(unsigned int nid, 2438void __meminit get_pfn_range_for_nid(unsigned int nid,
2439 unsigned long *start_pfn, unsigned long *end_pfn) 2439 unsigned long *start_pfn, unsigned long *end_pfn)
2440{ 2440{
2441 int i; 2441 int i;
@@ -2460,7 +2460,7 @@ void __init get_pfn_range_for_nid(unsigned int nid,
2460 * Return the number of pages a zone spans in a node, including holes 2460 * Return the number of pages a zone spans in a node, including holes
2461 * present_pages = zone_spanned_pages_in_node() - zone_absent_pages_in_node() 2461 * present_pages = zone_spanned_pages_in_node() - zone_absent_pages_in_node()
2462 */ 2462 */
2463unsigned long __init zone_spanned_pages_in_node(int nid, 2463unsigned long __meminit zone_spanned_pages_in_node(int nid,
2464 unsigned long zone_type, 2464 unsigned long zone_type,
2465 unsigned long *ignored) 2465 unsigned long *ignored)
2466{ 2466{
@@ -2488,7 +2488,7 @@ unsigned long __init zone_spanned_pages_in_node(int nid,
2488 * Return the number of holes in a range on a node. If nid is MAX_NUMNODES, 2488 * Return the number of holes in a range on a node. If nid is MAX_NUMNODES,
2489 * then all holes in the requested range will be accounted for. 2489 * then all holes in the requested range will be accounted for.
2490 */ 2490 */
2491unsigned long __init __absent_pages_in_range(int nid, 2491unsigned long __meminit __absent_pages_in_range(int nid,
2492 unsigned long range_start_pfn, 2492 unsigned long range_start_pfn,
2493 unsigned long range_end_pfn) 2493 unsigned long range_end_pfn)
2494{ 2494{
@@ -2548,7 +2548,7 @@ unsigned long __init absent_pages_in_range(unsigned long start_pfn,
2548} 2548}
2549 2549
2550/* Return the number of page frames in holes in a zone on a node */ 2550/* Return the number of page frames in holes in a zone on a node */
2551unsigned long __init zone_absent_pages_in_node(int nid, 2551unsigned long __meminit zone_absent_pages_in_node(int nid,
2552 unsigned long zone_type, 2552 unsigned long zone_type,
2553 unsigned long *ignored) 2553 unsigned long *ignored)
2554{ 2554{
@@ -2584,7 +2584,7 @@ static inline unsigned long zone_absent_pages_in_node(int nid,
2584 2584
2585#endif 2585#endif
2586 2586
2587static void __init calculate_node_totalpages(struct pglist_data *pgdat, 2587static void __meminit calculate_node_totalpages(struct pglist_data *pgdat,
2588 unsigned long *zones_size, unsigned long *zholes_size) 2588 unsigned long *zones_size, unsigned long *zholes_size)
2589{ 2589{
2590 unsigned long realtotalpages, totalpages = 0; 2590 unsigned long realtotalpages, totalpages = 0;
@@ -2692,7 +2692,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
2692 } 2692 }
2693} 2693}
2694 2694
2695static void __init alloc_node_mem_map(struct pglist_data *pgdat) 2695static void __meminit alloc_node_mem_map(struct pglist_data *pgdat)
2696{ 2696{
2697 /* Skip empty nodes */ 2697 /* Skip empty nodes */
2698 if (!pgdat->node_spanned_pages) 2698 if (!pgdat->node_spanned_pages)
diff --git a/mm/sparse.c b/mm/sparse.c
index 893e5621c247..9079afe8f457 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -61,7 +61,7 @@ static struct mem_section *sparse_index_alloc(int nid)
61 return section; 61 return section;
62} 62}
63 63
64static int sparse_index_init(unsigned long section_nr, int nid) 64static int __meminit sparse_index_init(unsigned long section_nr, int nid)
65{ 65{
66 static DEFINE_SPINLOCK(index_init_lock); 66 static DEFINE_SPINLOCK(index_init_lock);
67 unsigned long root = SECTION_NR_TO_ROOT(section_nr); 67 unsigned long root = SECTION_NR_TO_ROOT(section_nr);
@@ -138,7 +138,7 @@ static inline int sparse_early_nid(struct mem_section *section)
138} 138}
139 139
140/* Record a memory area against a node. */ 140/* Record a memory area against a node. */
141void memory_present(int nid, unsigned long start, unsigned long end) 141void __init memory_present(int nid, unsigned long start, unsigned long end)
142{ 142{
143 unsigned long pfn; 143 unsigned long pfn;
144 144
@@ -197,7 +197,7 @@ struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long pn
197 return ((struct page *)coded_mem_map) + section_nr_to_pfn(pnum); 197 return ((struct page *)coded_mem_map) + section_nr_to_pfn(pnum);
198} 198}
199 199
200static int sparse_init_one_section(struct mem_section *ms, 200static int __meminit sparse_init_one_section(struct mem_section *ms,
201 unsigned long pnum, struct page *mem_map) 201 unsigned long pnum, struct page *mem_map)
202{ 202{
203 if (!valid_section(ms)) 203 if (!valid_section(ms))
@@ -209,7 +209,7 @@ static int sparse_init_one_section(struct mem_section *ms,
209 return 1; 209 return 1;
210} 210}
211 211
212static struct page *sparse_early_mem_map_alloc(unsigned long pnum) 212static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum)
213{ 213{
214 struct page *map; 214 struct page *map;
215 struct mem_section *ms = __nr_to_section(pnum); 215 struct mem_section *ms = __nr_to_section(pnum);
@@ -288,6 +288,7 @@ void __init sparse_init(void)
288 } 288 }
289} 289}
290 290
291#ifdef CONFIG_MEMORY_HOTPLUG
291/* 292/*
292 * returns the number of sections whose mem_maps were properly 293 * returns the number of sections whose mem_maps were properly
293 * set. If this is <=0, then that means that the passed-in 294 * set. If this is <=0, then that means that the passed-in
@@ -327,3 +328,4 @@ out:
327 __kfree_section_memmap(memmap, nr_pages); 328 __kfree_section_memmap(memmap, nr_pages);
328 return ret; 329 return ret;
329} 330}
331#endif