/* Once this space has been set aside, the bootmem maps are initialized. We could probably move the allocation of the per-cpu and ia64_node_data space outside of this function and use alloc_bootmem_node(), but doing it here is straightforward and we get the alignments we want so...  */
static int __init find_pernode_space(unsigned long start, unsigned long len, int node)
/* Once this space has been set aside, the bootmem maps are initialized. We could probably move the allocation of the per-cpu and ia64_node_data space outside of this function and use alloc_bootmem_node(), but doing it here is straightforward and we get the alignments we want so...  */
static int __init find_pernode_space(unsigned long start, unsigned long len, int node)
{
	unsigned long spfn, epfn;
	unsigned long pernodesize = 0, pernode, pages, mapsize;
	struct bootmem_data *bdp = &bootmem_node_data[node];
	spfn = start >> PAGE_SHIFT;
	epfn = (start + len) >> PAGE_SHIFT;
	pages = bdp->node_low_pfn - bdp->node_min_pfn;
	mapsize = bootmem_bootmap_pages(pages) << PAGE_SHIFT;
	if (spfn < bdp->node_min_pfn || epfn > bdp->node_low_pfn)
		return 0;
	if (mem_data[node].pernode_addr)
		return 0;
	pernodesize = compute_pernodesize(node);
	pernode = NODEDATA_ALIGN(start, node);
	if (start + len > (pernode + pernodesize + mapsize))
		fill_pernode(node, pernode, pernodesize);
	return 0;
}