aboutsummaryrefslogtreecommitdiffstats
path: root/mm/sparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/sparse.c')
-rw-r--r--mm/sparse.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/mm/sparse.c b/mm/sparse.c
index 54f3940406cb..52843a76feed 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -9,6 +9,8 @@
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
11#include <asm/dma.h> 11#include <asm/dma.h>
12#include <asm/pgalloc.h>
13#include <asm/pgtable.h>
12 14
13/* 15/*
14 * Permanent SPARSEMEM data: 16 * Permanent SPARSEMEM data:
@@ -222,11 +224,10 @@ void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
222 return NULL; 224 return NULL;
223} 225}
224 226
225static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum) 227#ifndef CONFIG_SPARSEMEM_VMEMMAP
228struct page __init *sparse_early_mem_map_populate(unsigned long pnum, int nid)
226{ 229{
227 struct page *map; 230 struct page *map;
228 struct mem_section *ms = __nr_to_section(pnum);
229 int nid = sparse_early_nid(ms);
230 231
231 map = alloc_remap(nid, sizeof(struct page) * PAGES_PER_SECTION); 232 map = alloc_remap(nid, sizeof(struct page) * PAGES_PER_SECTION);
232 if (map) 233 if (map)
@@ -239,10 +240,22 @@ static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum)
239 240
240 map = alloc_bootmem_node(NODE_DATA(nid), 241 map = alloc_bootmem_node(NODE_DATA(nid),
241 sizeof(struct page) * PAGES_PER_SECTION); 242 sizeof(struct page) * PAGES_PER_SECTION);
243 return map;
244}
245#endif /* !CONFIG_SPARSEMEM_VMEMMAP */
246
247struct page __init *sparse_early_mem_map_alloc(unsigned long pnum)
248{
249 struct page *map;
250 struct mem_section *ms = __nr_to_section(pnum);
251 int nid = sparse_early_nid(ms);
252
253 map = sparse_early_mem_map_populate(pnum, nid);
242 if (map) 254 if (map)
243 return map; 255 return map;
244 256
245 printk(KERN_WARNING "%s: allocation failed\n", __FUNCTION__); 257 printk(KERN_ERR "%s: sparsemem memory map backing failed "
258 "some memory will not be available.\n", __FUNCTION__);
246 ms->section_mem_map = 0; 259 ms->section_mem_map = 0;
247 return NULL; 260 return NULL;
248} 261}