Re: [PATCH] Run PCI driver initialization on local node

Christoph Lameter
2005-07-07T13:54:01Z

On Thu, 7 Jul 2005, Andi Kleen wrote:

> > The slab allocator will do the right thing with the numa slab allocator in
> > Andrew's tree but not with the one in Linus'tree. The one is Linus tree
> > will just pickup whatever slab is available irregardless of the node.
>
> It should usually do the right thing because it
> runs on the correct CPUs. The only case that doesn't work
> is freeing on different CPUs than it was allocated, but hopefully
> that is not too common during system startup.

The current slab wont do that unless you allocate enough entries so
that a new page is retrieved from the page allocator. Then you may have
local memory from the slab (if the memory policy is not on round robin).

If you allocate some slab entries on one node then you typically have a
partially used page from that node. If you then switch to a different
processor on a different node and then use the slab allocator to get an
entry for that slab then that partially used page will be used! The
slab allocator will return an entry from the *prior* node.

> And then at some point NUMA aware slab will make it into mainline > I guess.

Hopefully.

> > Only kmalloc_node will make a reasonable attempt to locate the memory on
> > a specific node.
>
> You forgot __get_free_pages.

The slab allocator uses alloc_pages and alloc_pages_node