Re: [patch 2/2] mm: add node hotplug emulation

From: Greg KH
Date: Sun Nov 21 2010 - 12:34:09 EST


On Sat, Nov 20, 2010 at 06:28:38PM -0800, David Rientjes wrote:
>
> Add an interface to allow new nodes to be added when performing memory
> hot-add. This provides a convenient interface to test memory hotplug
> notifier callbacks and surrounding hotplug code when new nodes are
> onlined without actually having a machine with such hotpluggable SRAT
> entries.
>
> This adds a new interface at /sys/devices/system/memory/add_node that
> behaves in a similar way to the memory hot-add "probe" interface. Its
> format is size@start, where "size" is the size of the new node to be
> added and "start" is the physical address of the new memory.

Ick, we are trying to clean up the system devices right now which would
prevent this type of tree being added.

> The new node id is a currently offline, but possible, node. The bit must
> be set in node_possible_map so that nr_node_ids is sized appropriately.
>
> For emulation on x86, for example, it would be possible to set aside
> memory for hotplugged nodes (say, anything above 2G) and to add an
> additional three nodes as being possible on boot with
>
> mem=2G numa=possible=3
>
> and then creating a new 128M node at runtime:
>
> # echo 128M@0x80000000 > /sys/devices/system/memory/add_node
> On node 1 totalpages: 0
> init_memory_mapping: 0000000080000000-0000000088000000
> 0080000000 - 0088000000 page 2M
>
> Once the new node has been added, its memory can be onlined. If this
> memory represents memory section 16, for example:
>
> # echo online > /sys/devices/system/memory/memory16/state
> Built 2 zonelists in Node order, mobility grouping on. Total pages: 514846
> Policy zone: Normal
>
> [ The memory section(s) mapped to a particular node are visible via
> /sys/devices/system/node/node1, in this example. ]
>
> The new node is now hotplugged and ready for testing.
>
> Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
> ---
> Documentation/memory-hotplug.txt | 24 ++++++++++++++++++++++++
> drivers/base/memory.c | 36 +++++++++++++++++++++++++++++++++++-
> 2 files changed, 59 insertions(+), 1 deletions(-)

When adding sysfs files you need to document it in Documentation/ABI
instead.

But as this is a debugging thing, why not just put it in debugfs
instead?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/