aboutsummaryrefslogtreecommitdiffstats
path: root/mm/sparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/sparse.c')
-rw-r--r--mm/sparse.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/mm/sparse.c b/mm/sparse.c
index f13f2723950a..b1b14a9c4041 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -257,19 +257,14 @@ struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long pn
257 return ((struct page *)coded_mem_map) + section_nr_to_pfn(pnum); 257 return ((struct page *)coded_mem_map) + section_nr_to_pfn(pnum);
258} 258}
259 259
260static int __meminit sparse_init_one_section(struct mem_section *ms, 260static void __meminit sparse_init_one_section(struct mem_section *ms,
261 unsigned long pnum, struct page *mem_map, 261 unsigned long pnum, struct page *mem_map,
262 unsigned long *pageblock_bitmap) 262 unsigned long *pageblock_bitmap)
263{ 263{
264 if (!present_section(ms))
265 return -EINVAL;
266
267 ms->section_mem_map &= ~SECTION_MAP_MASK; 264 ms->section_mem_map &= ~SECTION_MAP_MASK;
268 ms->section_mem_map |= sparse_encode_mem_map(mem_map, pnum) | 265 ms->section_mem_map |= sparse_encode_mem_map(mem_map, pnum) |
269 SECTION_HAS_MEM_MAP; 266 SECTION_HAS_MEM_MAP;
270 ms->pageblock_flags = pageblock_bitmap; 267 ms->pageblock_flags = pageblock_bitmap;
271
272 return 1;
273} 268}
274 269
275unsigned long usemap_size(void) 270unsigned long usemap_size(void)
@@ -760,6 +755,7 @@ int __meminit sparse_add_one_section(struct pglist_data *pgdat,
760 ret = sparse_index_init(section_nr, pgdat->node_id); 755 ret = sparse_index_init(section_nr, pgdat->node_id);
761 if (ret < 0 && ret != -EEXIST) 756 if (ret < 0 && ret != -EEXIST)
762 return ret; 757 return ret;
758 ret = 0;
763 memmap = kmalloc_section_memmap(section_nr, pgdat->node_id, altmap); 759 memmap = kmalloc_section_memmap(section_nr, pgdat->node_id, altmap);
764 if (!memmap) 760 if (!memmap)
765 return -ENOMEM; 761 return -ENOMEM;
@@ -786,12 +782,11 @@ int __meminit sparse_add_one_section(struct pglist_data *pgdat,
786#endif 782#endif
787 783
788 section_mark_present(ms); 784 section_mark_present(ms);
789 785 sparse_init_one_section(ms, section_nr, memmap, usemap);
790 ret = sparse_init_one_section(ms, section_nr, memmap, usemap);
791 786
792out: 787out:
793 pgdat_resize_unlock(pgdat, &flags); 788 pgdat_resize_unlock(pgdat, &flags);
794 if (ret <= 0) { 789 if (ret < 0) {
795 kfree(usemap); 790 kfree(usemap);
796 __kfree_section_memmap(memmap, altmap); 791 __kfree_section_memmap(memmap, altmap);
797 } 792 }