24 #include <linux/slab.h>
27 #include <linux/sched.h>
29 #include <asm/pgalloc.h>
30 #include <asm/pgtable.h>
46 static void *vmemmap_buf;
47 static void *vmemmap_buf_end;
56 page = alloc_pages_node(node,
65 return __earlyonly_bootmem_alloc(node, size, size,
78 ptr = (
void *)
ALIGN((
unsigned long)vmemmap_buf,
size);
79 if (ptr + size > vmemmap_buf_end)
82 vmemmap_buf = ptr +
size;
88 unsigned long start,
unsigned long end)
90 unsigned long pfn =
pte_pfn(*pte);
91 int actual_node = early_pfn_to_nid(pfn);
95 "page_structs\n", start, end - 1);
149 unsigned long size,
int node)
151 unsigned long addr = (
unsigned long)start_page;
152 unsigned long end = (
unsigned long)(start_page + size);
188 unsigned long pnum_begin,
189 unsigned long pnum_end,
190 unsigned long map_count,
int nodeid)
193 unsigned long size =
sizeof(
struct page) * PAGES_PER_SECTION;
194 void *vmemmap_buf_start;
197 vmemmap_buf_start = __earlyonly_bootmem_alloc(nodeid, size * map_count,
200 if (vmemmap_buf_start) {
201 vmemmap_buf = vmemmap_buf_start;
202 vmemmap_buf_end = vmemmap_buf_start + size * map_count;
205 for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
206 struct mem_section *
ms;
208 if (!present_section_nr(pnum))
214 ms = __nr_to_section(pnum);
216 "some memory will not be available.\n", __func__);
217 ms->section_mem_map = 0;
220 if (vmemmap_buf_start) {
224 vmemmap_buf_end =
NULL;