25 #include <asm/pgalloc.h>
26 #include <asm/pgtable.h>
27 #include <asm/sections.h>
30 #ifdef CONFIG_VIRTUAL_MEM_MAP
31 static unsigned long max_gap;
42 int i, total_reserved = 0;
43 int total_shared = 0, total_cached = 0;
44 unsigned long total_present = 0;
51 unsigned long present;
58 pgdat_resize_lock(pgdat, &flags);
67 #ifdef CONFIG_VIRTUAL_MEM_MAP
68 if (max_gap < LARGE_GAP)
71 i = vmemmap_find_next_valid_pfn(nid, i) - 1;
74 if (PageReserved(page))
76 else if (PageSwapCache(page))
78 else if (page_count(page))
79 shared += page_count(page)-1;
81 pgdat_resize_unlock(pgdat, &flags);
82 total_present += present;
87 "shrd: %10d, swpd: %10d\n", nid,
115 u64 needed = *(
unsigned long *)arg;
130 range_start =
max(start, free_start);
135 if (range_end <= range_start)
138 if (range_end - range_start >= needed) {
144 if (range_end == end)
160 static bool first_time =
true;
161 void *cpu0_data = __cpu0_per_cpu;
177 __per_cpu_offset[
cpu] = (
char *)
cpu_data - __per_cpu_start;
178 per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[
cpu];
191 (
unsigned long)__per_cpu_start);
225 panic(
"failed to allocate pcpu_alloc_info");
233 static_size = __per_cpu_end - __per_cpu_start;
238 static_size, reserved_size);
240 ai->static_size = static_size;
241 ai->reserved_size = reserved_size;
242 ai->dyn_size = dyn_size;
245 ai->alloc_size = PERCPU_PAGE_SIZE;
254 #define alloc_per_cpu_data() do { } while (0)
266 unsigned long bootmap_size;
282 panic(
"Cannot find %ld bytes for bootmap\n", bootmap_size);
311 unsigned long max_dma;
312 unsigned long max_zone_pfns[MAX_NR_ZONES];
317 memset(max_zone_pfns, 0,
sizeof(max_zone_pfns));
318 #ifdef CONFIG_ZONE_DMA
320 max_zone_pfns[ZONE_DMA] = max_dma;
324 #ifdef CONFIG_VIRTUAL_MEM_MAP
327 if (max_gap < LARGE_GAP) {
328 vmem_map = (
struct page *) 0;
329 free_area_init_nodes(max_zone_pfns);
331 unsigned long map_size;
336 sizeof(
struct page));
346 find_min_pfn_with_active_regions();
347 free_area_init_nodes(max_zone_pfns);
353 free_area_init_nodes(max_zone_pfns);