diff options
Diffstat (limited to 'mm/sparse.c')
-rw-r--r-- | mm/sparse.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/mm/sparse.c b/mm/sparse.c index 4900707ae146..044138852baf 100644 --- a/mm/sparse.c +++ b/mm/sparse.c | |||
@@ -23,8 +23,7 @@ | |||
23 | * 1) mem_section - memory sections, mem_map's for valid memory | 23 | * 1) mem_section - memory sections, mem_map's for valid memory |
24 | */ | 24 | */ |
25 | #ifdef CONFIG_SPARSEMEM_EXTREME | 25 | #ifdef CONFIG_SPARSEMEM_EXTREME |
26 | struct mem_section *mem_section[NR_SECTION_ROOTS] | 26 | struct mem_section **mem_section; |
27 | ____cacheline_internodealigned_in_smp; | ||
28 | #else | 27 | #else |
29 | struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT] | 28 | struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT] |
30 | ____cacheline_internodealigned_in_smp; | 29 | ____cacheline_internodealigned_in_smp; |
@@ -101,7 +100,7 @@ static inline int sparse_index_init(unsigned long section_nr, int nid) | |||
101 | int __section_nr(struct mem_section* ms) | 100 | int __section_nr(struct mem_section* ms) |
102 | { | 101 | { |
103 | unsigned long root_nr; | 102 | unsigned long root_nr; |
104 | struct mem_section* root; | 103 | struct mem_section *root = NULL; |
105 | 104 | ||
106 | for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) { | 105 | for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) { |
107 | root = __nr_to_section(root_nr * SECTIONS_PER_ROOT); | 106 | root = __nr_to_section(root_nr * SECTIONS_PER_ROOT); |
@@ -112,7 +111,7 @@ int __section_nr(struct mem_section* ms) | |||
112 | break; | 111 | break; |
113 | } | 112 | } |
114 | 113 | ||
115 | VM_BUG_ON(root_nr == NR_SECTION_ROOTS); | 114 | VM_BUG_ON(!root); |
116 | 115 | ||
117 | return (root_nr * SECTIONS_PER_ROOT) + (ms - root); | 116 | return (root_nr * SECTIONS_PER_ROOT) + (ms - root); |
118 | } | 117 | } |
@@ -330,11 +329,17 @@ again: | |||
330 | static void __init check_usemap_section_nr(int nid, unsigned long *usemap) | 329 | static void __init check_usemap_section_nr(int nid, unsigned long *usemap) |
331 | { | 330 | { |
332 | unsigned long usemap_snr, pgdat_snr; | 331 | unsigned long usemap_snr, pgdat_snr; |
333 | static unsigned long old_usemap_snr = NR_MEM_SECTIONS; | 332 | static unsigned long old_usemap_snr; |
334 | static unsigned long old_pgdat_snr = NR_MEM_SECTIONS; | 333 | static unsigned long old_pgdat_snr; |
335 | struct pglist_data *pgdat = NODE_DATA(nid); | 334 | struct pglist_data *pgdat = NODE_DATA(nid); |
336 | int usemap_nid; | 335 | int usemap_nid; |
337 | 336 | ||
337 | /* First call */ | ||
338 | if (!old_usemap_snr) { | ||
339 | old_usemap_snr = NR_MEM_SECTIONS; | ||
340 | old_pgdat_snr = NR_MEM_SECTIONS; | ||
341 | } | ||
342 | |||
338 | usemap_snr = pfn_to_section_nr(__pa(usemap) >> PAGE_SHIFT); | 343 | usemap_snr = pfn_to_section_nr(__pa(usemap) >> PAGE_SHIFT); |
339 | pgdat_snr = pfn_to_section_nr(__pa(pgdat) >> PAGE_SHIFT); | 344 | pgdat_snr = pfn_to_section_nr(__pa(pgdat) >> PAGE_SHIFT); |
340 | if (usemap_snr == pgdat_snr) | 345 | if (usemap_snr == pgdat_snr) |