Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

From: Gerald Schaefer
Date: Wed Sep 12 2018 - 10:29:08 EST


On Mon, 10 Sep 2018 15:26:55 +0000
Pasha Tatashin <Pavel.Tatashin@xxxxxxxxxxxxx> wrote:

>
> I agree memoryblock is a hack, it fails to do both things it was
> designed to do:
>
> 1. On bare metal you cannot free a physical dimm of memory using
> memoryblock granularity because memory devices do not equal to physical
> dimms. Thus, if for some reason a particular dimm must be
> remove/replaced, memoryblock does not help us.
>
> 2. On machines with hypervisors it fails to provide an adequate
> granularity to add/remove memory.
>
> We should define a new user interface where memory can be added/removed
> at a finer granularity: sparse section size, but without a memory
> devices for each section. We should also provide an optional access to
> legacy interface where memory devices are exported but each is of
> section size.
>
> So, when legacy interface is enabled, current way would work:
>
> echo offline > /sys/devices/system/memory/memoryXXX/state
>
> And new interface would allow us to do something like this:
>
> echo offline 256M > /sys/devices/system/node/nodeXXX/memory
>
> With optional start address for offline memory.
> echo offline [start_pa] size > /sys/devices/system/node/nodeXXX/memory
> start_pa and size must be section size aligned (128M).
>
> It would probably be a good discussion for the next MM Summit how to
> solve the current memory hotplug interface limitations.

Please keep lsmem/chmem from util-linux in mind, when changing the
memory hotplug user interface.