Re: [PATCH] slob: poor man's NUMA, take 2.

Paul Mundt
2007-06-13T04:23:06Z

On Wed, Jun 13, 2007 at 01:13:19PM +0900, Paul Mundt wrote:
> On Wed, Jun 13, 2007 at 01:42:28PM +1000, Nick Piggin wrote:
> > OTOH, there are lots of places that don't specify the node explicitly,
> > but most of them prefer the allocation to come from the current node...
> > and that case isn't handled very well is it?
> >
> Well, we could throw in a numa_node_id() for kmem_cache_alloc() and
> __kmalloc(), that would actually simplify slob_new_page(), since we can
> just use alloc_pages_node() directly in the NUMA case without special
> casing the node id.
>
> This also has the side-effect of working well on UP with asymmetric nodes
> (assuming a larger node 0), since numa_node_id() will leave us with a
> node 0 preference in places where the node id isn't explicitly given.
>
And sure enough, that's what alloc_pages_node() already does, so if
slob_new_page() simply wraps in to it it should already be handled:

static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
unsigned int order)
{
...

/* Unknown node is current node */
if (nid < 0)
nid = numa_node_id();
...

I'll update the patch..