Lines Matching refs:bdata
28 .bdata = &bootmem_node_data[0]
78 static void __init link_bootmem(bootmem_data_t *bdata) in link_bootmem() argument
86 if (bdata->node_min_pfn < ent->node_min_pfn) in link_bootmem()
89 list_add_tail(&bdata->list, iter); in link_bootmem()
95 static unsigned long __init init_bootmem_core(bootmem_data_t *bdata, in init_bootmem_core() argument
101 bdata->node_bootmem_map = phys_to_virt(PFN_PHYS(mapstart)); in init_bootmem_core()
102 bdata->node_min_pfn = start; in init_bootmem_core()
103 bdata->node_low_pfn = end; in init_bootmem_core()
104 link_bootmem(bdata); in init_bootmem_core()
111 memset(bdata->node_bootmem_map, 0xff, mapsize); in init_bootmem_core()
114 bdata - bootmem_node_data, start, mapstart, end, mapsize); in init_bootmem_core()
131 return init_bootmem_core(pgdat->bdata, freepfn, startpfn, endpfn); in init_bootmem_node()
145 return init_bootmem_core(NODE_DATA(0)->bdata, start, 0, pages); in init_bootmem()
172 static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) in free_all_bootmem_core() argument
178 if (!bdata->node_bootmem_map) in free_all_bootmem_core()
181 start = bdata->node_min_pfn; in free_all_bootmem_core()
182 end = bdata->node_low_pfn; in free_all_bootmem_core()
191 bdata - bootmem_node_data, start, end, aligned); in free_all_bootmem_core()
196 map = bdata->node_bootmem_map; in free_all_bootmem_core()
197 idx = start - bdata->node_min_pfn; in free_all_bootmem_core()
221 page = virt_to_page(bdata->node_bootmem_map); in free_all_bootmem_core()
222 pages = bdata->node_low_pfn - bdata->node_min_pfn; in free_all_bootmem_core()
228 bdebug("nid=%td released=%lx\n", bdata - bootmem_node_data, count); in free_all_bootmem_core()
242 return free_all_bootmem_core(pgdat->bdata); in free_all_bootmem_node()
253 bootmem_data_t *bdata; in free_all_bootmem() local
255 list_for_each_entry(bdata, &bdata_list, list) in free_all_bootmem()
256 total_pages += free_all_bootmem_core(bdata); in free_all_bootmem()
261 static void __init __free(bootmem_data_t *bdata, in __free() argument
266 bdebug("nid=%td start=%lx end=%lx\n", bdata - bootmem_node_data, in __free()
267 sidx + bdata->node_min_pfn, in __free()
268 eidx + bdata->node_min_pfn); in __free()
270 if (bdata->hint_idx > sidx) in __free()
271 bdata->hint_idx = sidx; in __free()
274 if (!test_and_clear_bit(idx, bdata->node_bootmem_map)) in __free()
278 static int __init __reserve(bootmem_data_t *bdata, unsigned long sidx, in __reserve() argument
285 bdata - bootmem_node_data, in __reserve()
286 sidx + bdata->node_min_pfn, in __reserve()
287 eidx + bdata->node_min_pfn, in __reserve()
291 if (test_and_set_bit(idx, bdata->node_bootmem_map)) { in __reserve()
293 __free(bdata, sidx, idx); in __reserve()
297 idx + bdata->node_min_pfn); in __reserve()
302 static int __init mark_bootmem_node(bootmem_data_t *bdata, in mark_bootmem_node() argument
309 bdata - bootmem_node_data, start, end, reserve, flags); in mark_bootmem_node()
311 BUG_ON(start < bdata->node_min_pfn); in mark_bootmem_node()
312 BUG_ON(end > bdata->node_low_pfn); in mark_bootmem_node()
314 sidx = start - bdata->node_min_pfn; in mark_bootmem_node()
315 eidx = end - bdata->node_min_pfn; in mark_bootmem_node()
318 return __reserve(bdata, sidx, eidx, flags); in mark_bootmem_node()
320 __free(bdata, sidx, eidx); in mark_bootmem_node()
328 bootmem_data_t *bdata; in mark_bootmem() local
331 list_for_each_entry(bdata, &bdata_list, list) { in mark_bootmem()
335 if (pos < bdata->node_min_pfn || in mark_bootmem()
336 pos >= bdata->node_low_pfn) { in mark_bootmem()
341 max = min(bdata->node_low_pfn, end); in mark_bootmem()
343 err = mark_bootmem_node(bdata, pos, max, reserve, flags); in mark_bootmem()
351 pos = bdata->node_low_pfn; in mark_bootmem()
376 mark_bootmem_node(pgdat->bdata, start, end, 0, 0); in free_bootmem_node()
419 return mark_bootmem_node(pgdat->bdata, start, end, 1, flags); in reserve_bootmem_node()
449 static unsigned long __init align_idx(struct bootmem_data *bdata, in align_idx() argument
452 unsigned long base = bdata->node_min_pfn; in align_idx()
462 static unsigned long __init align_off(struct bootmem_data *bdata, in align_off() argument
465 unsigned long base = PFN_PHYS(bdata->node_min_pfn); in align_off()
472 static void * __init alloc_bootmem_core(struct bootmem_data *bdata, in alloc_bootmem_core() argument
480 bdata - bootmem_node_data, size, PAGE_ALIGN(size) >> PAGE_SHIFT, in alloc_bootmem_core()
487 if (!bdata->node_bootmem_map) in alloc_bootmem_core()
490 min = bdata->node_min_pfn; in alloc_bootmem_core()
491 max = bdata->node_low_pfn; in alloc_bootmem_core()
508 sidx = start - bdata->node_min_pfn; in alloc_bootmem_core()
509 midx = max - bdata->node_min_pfn; in alloc_bootmem_core()
511 if (bdata->hint_idx > sidx) { in alloc_bootmem_core()
517 sidx = align_idx(bdata, bdata->hint_idx, step); in alloc_bootmem_core()
525 sidx = find_next_zero_bit(bdata->node_bootmem_map, midx, sidx); in alloc_bootmem_core()
526 sidx = align_idx(bdata, sidx, step); in alloc_bootmem_core()
533 if (test_bit(i, bdata->node_bootmem_map)) { in alloc_bootmem_core()
534 sidx = align_idx(bdata, i, step); in alloc_bootmem_core()
540 if (bdata->last_end_off & (PAGE_SIZE - 1) && in alloc_bootmem_core()
541 PFN_DOWN(bdata->last_end_off) + 1 == sidx) in alloc_bootmem_core()
542 start_off = align_off(bdata, bdata->last_end_off, align); in alloc_bootmem_core()
549 bdata->last_end_off = end_off; in alloc_bootmem_core()
550 bdata->hint_idx = PFN_UP(end_off); in alloc_bootmem_core()
555 if (__reserve(bdata, PFN_DOWN(start_off) + merge, in alloc_bootmem_core()
559 region = phys_to_virt(PFN_PHYS(bdata->node_min_pfn) + in alloc_bootmem_core()
571 sidx = align_idx(bdata, fallback - 1, step); in alloc_bootmem_core()
579 static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata, in alloc_arch_preferred_bootmem() argument
590 p_bdata = bootmem_arch_preferred_node(bdata, size, align, in alloc_arch_preferred_bootmem()
605 bootmem_data_t *bdata; in ___alloc_bootmem_nopanic() local
613 list_for_each_entry(bdata, &bdata_list, list) { in ___alloc_bootmem_nopanic()
614 if (goal && bdata->node_low_pfn <= PFN_DOWN(goal)) in ___alloc_bootmem_nopanic()
616 if (limit && bdata->node_min_pfn >= PFN_DOWN(limit)) in ___alloc_bootmem_nopanic()
619 region = alloc_bootmem_core(bdata, size, align, goal, limit); in ___alloc_bootmem_nopanic()
689 static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, in ___alloc_bootmem_node() argument
695 ptr = alloc_arch_preferred_bootmem(bdata, size, align, goal, limit); in ___alloc_bootmem_node()
699 ptr = alloc_bootmem_core(bdata, size, align, goal, limit); in ___alloc_bootmem_node()
727 return ___alloc_bootmem_node(pgdat->bdata, size, align, goal, 0); in __alloc_bootmem_node()
748 ptr = alloc_bootmem_core(pgdat->bdata, size, align, in __alloc_bootmem_node_high()
770 bootmem_data_t *bdata; in alloc_bootmem_section() local
776 bdata = &bootmem_node_data[early_pfn_to_nid(pfn)]; in alloc_bootmem_section()
778 return alloc_bootmem_core(bdata, size, SMP_CACHE_BYTES, goal, limit); in alloc_bootmem_section()
790 ptr = alloc_arch_preferred_bootmem(pgdat->bdata, size, align, goal, 0); in __alloc_bootmem_node_nopanic()
794 ptr = alloc_bootmem_core(pgdat->bdata, size, align, goal, 0); in __alloc_bootmem_node_nopanic()
845 return ___alloc_bootmem_node(pgdat->bdata, size, align, in __alloc_bootmem_low_node()