Re: [PATCH] allocate page caches pages in round robin fasion

From: William Lee Irwin III
Date: Thu Aug 12 2004 - 19:17:32 EST


On Thu, Aug 12, 2004 at 04:46:50PM -0700, Jesse Barnes wrote:
> +struct page *alloc_page_round_robin(unsigned int gfp_mask)
> +{
> + return alloc_pages_node(__get_cpu_var(next_rr_node)++ % numnodes,
> + gfp_mask, 0);
> +}
> +

Interesting. This may attempt to allocate from offlined nodes, assuming
one adds on sufficient hotplug bits atop mainline and/or -mm. The
following almost does it hotplug-safe except that it needs to enter the
allocator with preemption disabled and drop the preempt_count
internally to it.

static struct page *alloc_page_round_robin(unsigned gfp_mask)
{
int nid, next_nid, *rr_node = &__get_cpu_var(next_rr_node);

nid = *rr_node;
next_nid = next_node(nid, node_online_map);
if (next_nid >= MAX_NR_NODES)
*rr_node = first_node(node_online_map);
else
*rr_node = next_nid;
return alloc_pages_node(nid, gfp_mask, 0);
}

I suspect we are better off punting this in the direction of hotplug
people than trying to address it ourselves. I think we should go with
this now, as the node hotplug bits are yet to hit the tree.


-- wli
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/