Re: [patch v2] slab: add memory hotplug support

David Rientjes
2010-04-04T20:46:10Z

On Tue, 30 Mar 2010, Christoph Lameter wrote:

> > Nick, Christoph, lets make a a deal: you ACK, I merge. How does that
> > sound to you?
>
> I looked through the patch before and slabwise this seems to beok but I am
> still not very sure how this interacts with the node and cpu bootstrap.
> You can have the ack with this caveat.
>
> Acked-by: Christoph Lameter <cl@linux-foundation.org>
>

Thanks.

I tested this for node hotplug by setting ACPI_SRAT_MEM_HOT_PLUGGABLE
regions and then setting up a new memory section with
/sys/devices/system/memory/probe. I onlined the new memory section, which
mapped to an offline node, and verified that the nwe nodelists were
initialized correctly. This is done before the MEM_ONLINE notifier and
the bit being set in node_states[N_HIGH_MEMORY]. So, for node hot-add, it
works.

MEM_GOING_OFFLINE is more interesting, but there's nothing harmful about
draining the freelist and reporting whether there are existing full or
partial slabs back to the memory hotplug layer to preempt a hot-remove
since those slabs cannot be freed. I don't consider that to be a risky
change.

As far as the interactions between memory and cpu hotplug, they are really
different things with many of the same implications for the slab layer.
Both have the possibility of bringing new nodes online or offline and they
must be dealt with accordingly. We lack support for offlining an entire
node at a time since we must hotplug first by adding a new memory section,
so these notifiers won't be called simultaneously. Even if they were,
draining the freelist and checking if a nodelist needs to be initialized
is not going to be harmful since both notifiers have the same checks for
existing nodelists (which is not only necessary if we _did_ have
simultaneous cpu and memory hot-add, but also if a node transitioned from
online to offline and back to online).

I hope this patch is merged because it obviously fixed a problem on my box
where a memory section could be added, a node onlined, and then no slab
metadata being initialized for that memory.