13 #include <linux/slab.h>
15 #include <linux/export.h>
22 #include <asm/processor.h>
26 #ifndef CONFIG_NEED_MULTIPLE_NODES
41 if (limit > memblock.current_limit)
42 limit = memblock.current_limit;
70 unsigned long cursor,
end;
77 for (; cursor <
end; cursor++) {
83 static void __init __free_pages_memory(
unsigned long start,
unsigned long end)
85 unsigned long i, start_aligned, end_aligned;
91 if (end_aligned <= start_aligned) {
92 for (i = start; i <
end; i++)
98 for (i = start; i < start_aligned; i++)
104 for (i = end_aligned; i <
end; i++)
111 unsigned long start_pfn =
PFN_UP(start);
112 unsigned long end_pfn =
min_t(
unsigned long,
115 if (start_pfn > end_pfn)
118 __free_pages_memory(start_pfn, end_pfn);
120 return end_pfn - start_pfn;
125 unsigned long count = 0;
130 count += __free_memory_core(start, end);
135 count += __free_memory_core(start, start + size);
148 register_page_bootmem_info_node(pgdat);
201 static void *
__init ___alloc_bootmem_nopanic(
unsigned long size,
213 ptr = __alloc_memory_core_early(
MAX_NUMNODES, size, align, goal, limit);
242 unsigned long limit = -1
UL;
244 return ___alloc_bootmem_nopanic(size, align, goal, limit);
247 static void *
__init ___alloc_bootmem(
unsigned long size,
unsigned long align,
248 unsigned long goal,
unsigned long limit)
250 void *
mem = ___alloc_bootmem_nopanic(size, align, goal, limit);
258 panic(
"Out of memory");
278 unsigned long limit = -1
UL;
280 return ___alloc_bootmem(size, align, goal, limit);
292 ptr = __alloc_memory_core_early(pgdat->
node_id, size, align,
297 ptr = __alloc_memory_core_early(
MAX_NUMNODES, size, align,
311 unsigned long align,
unsigned long goal)
320 unsigned long align,
unsigned long goal,
330 panic(
"Out of memory");
350 unsigned long align,
unsigned long goal)
359 unsigned long align,
unsigned long goal)
364 #ifndef ARCH_LOW_ADDRESS_LIMIT
365 #define ARCH_LOW_ADDRESS_LIMIT 0xffffffffUL
403 unsigned long align,
unsigned long goal)