Re: [patch] slab: add memory hotplug support

David Rientjes
2010-03-03T02:39:32Z

On Wed, 3 Mar 2010, KAMEZAWA Hiroyuki wrote:

> At node hot-add
>
> * pgdat is allocated from other node (because we have no memory for "nid")
> * memmap for the first section (and possiby others) will be allocated from
> other nodes.
> * Once a section for the node is onlined, any memory can be allocated localy.
>

Correct, and the struct kmem_list3 is also alloacted from other nodes with
my patch.

> (Allocating memory from local node requires some new implementation as
> bootmem allocater, we didn't that.)
>
> Before this patch, slab's control layer is allocated by cpuhotplug.
> So, at least keeping this order,
> memory online -> cpu online
> slab's control layer is allocated from local node.
>
> When node-hotadd is done in this order
> cpu online -> memory online
> kmalloc_node() will allocate memory from other node via fallback.
>
> After this patch, slab's control layer is allocated by memory hotplug.
> Then, in any order, slab's control will be allocated via fallback routine.
>

Again, this addresses memory hotplug that requires a new node to be
onlined that do not have corresponding cpus that are being onlined. On
x86, these represent ACPI_SRAT_MEM_HOT_PLUGGABLE regions that are onlined
either by the acpi hotplug or done manually with CONFIG_ARCH_MEMORY_PROBE.
On other architectures such as powerpc, this is done in different ways.

All of this is spelled out in the changelog for the patch.