From: Bjorn Helgaas on 29 Jun 2010 14:00 On Tuesday, June 22, 2010 11:26:41 am Yinghai Lu wrote: > + pr_info("Subtract (%d early reservations)\n", count); > + > + for_each_lmb(reserved, r) { > + pr_info(" [%010llx - %010llx]\n", (u64)r->base, (u64)r->base + r->size); Use %pR format and consider adding text to the line, e.g., "lmb: early reservation [%#010llx-%#010llx] removed" so that grep output is useful all by itself, without requiring the context of the preceding lines. > + final_start = PFN_DOWN(r->base); > + final_end = PFN_UP(r->base + r->size); > + if (final_start >= final_end) > + continue; > + subtract_range(range, az, final_start, final_end); > + } > + /* Put region array back ? */ > + if (lmb.reserved.regions != lmb_reserved_init_regions) > + lmb_reserve(__pa(lmb.reserved.regions), sizeof(struct lmb_region) * lmb.reserved.max); > +} > + > +struct count_data { > + int nr; > +}; > + > +static int __init count_work_fn(unsigned long start_pfn, > + unsigned long end_pfn, void *datax) > +{ > + struct count_data *data = datax; > + > + data->nr++; > + > + return 0; > +} > + > +static int __init count_early_node_map(int nodeid) > +{ > + struct count_data data; > + > + data.nr = 0; > + work_with_active_regions(nodeid, count_work_fn, &data); > + > + return data.nr; > +} > + > +int __init get_free_all_memory_range(struct range **rangep, int nodeid) > +{ > + int count; > + struct range *range; > + int nr_range; > + > + count = (lmb.reserved.cnt + count_early_node_map(nodeid)) * 2; > + > + range = find_range_array(count); > + nr_range = 0; > + > + /* > + * Use early_node_map[] and lmb.reserved.region to get range array > + * at first > + */ > + nr_range = add_from_early_node_map(range, count, nr_range, nodeid); > +#ifdef CONFIG_X86_32 > + subtract_range(range, count, max_low_pfn, -1ULL); > +#endif > + subtract_lmb_reserved(range, count); > + nr_range = clean_sort_range(range, count); > + > + *rangep = range; > + return nr_range; > +} > +#else > void __init lmb_to_bootmem(u64 start, u64 end) > { > int count; > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: lmb: Print new doubled array location info Next: x86,lmb: Add lmb_reserve_range/lmb_free_range |