/* Allocate the specified number of contiguous uncached pages on the the requested node. If not enough contiguous uncached pages are available on the requested node, roundrobin starting with the next higher node.  */
unsigned long uncached_alloc_page(int starting_nid, int n_pages)
/* Allocate the specified number of contiguous uncached pages on the the requested node. If not enough contiguous uncached pages are available on the requested node, roundrobin starting with the next higher node.  */
unsigned long uncached_alloc_page(int starting_nid, int n_pages)
{
	unsigned long uc_addr;
	struct uncached_pool *uc_pool;
	int nid;
	if (unlikely(starting_nid >= MAX_NUMNODES))
		return 0;
	if (starting_nid < 0)
		starting_nid = numa_node_id();
	nid = starting_nid;
	do {
		if (!node_state(nid, N_HIGH_MEMORY))
			continue;
		uc_pool = &uncached_pools[nid];
		if (uc_pool->pool == NULL)
			continue;
		do {
			uc_addr = gen_pool_alloc(uc_pool->pool,
						 n_pages * PAGE_SIZE);
			if (uc_addr != 0)
				return uc_addr;
		} while (uncached_add_chunk(uc_pool, nid) == 0);
	} while ((nid = (nid + 1) % MAX_NUMNODES) != starting_nid);
	return 0;
}