How to use memory hotplug

1. Download and Applying patch

To use Memory Hotplug feature, you need followings.
  1. Stock kernel source code, or prepatch.
  2. Andrew Morton's -mm tree patch.
  3. -mhp patch.
Which version of patches is necessary depends on -mhp3. For example,
if you would like to use patch-2.6.10-rc2-mm4-mhp3, you need more 2 patches.
1) Stock kernel prepatch version 2.6.10-rc2
2) -mm tree patch 2.6.10-rc2-mm4

 If you would like to read the memory hotplug patch, you can get divided patches
for each purposes in `broken-out' directory of -mhp patch.

2. Kernel Configuration and Compile

Turn on these config options in 'Processor type and features' category to compile kernel.
You can refer .configs for 2.6.10-rc2-mm4-mhp3 or later in its patch's page.
If you have a trouble, its cause might came from kernel configuration. Please check it.

3. Booting kernel

 Even if you have just ordinary PC, you can try memory hot-add feature logically.
For this purpose, you have to disable a part of memory by boot option "mem=". 
If you specify smaller memory size than real size, you can disable and hot-add the remaining memory after booting.
This size has to be aligned by nonlinear's section size. It depends on architecture in current -mhp patches.
(See : include/linux/nonlinear.h and include/asm/nonlinear.h.)

4. Hotplug command

After booting new compiled kernel, new memory hotplug command will be available.

Hot Add memory

$ echo "(physical memory address)" > /sys/device/system/memory/probe

This command is to identify new memory. If address is valid and no error is occurred, new directory of added section will appear as /sys/device/system/memory/memoryX.
To use its area, one more command is necessary.

$ echo "online" > /sys/device/system/memory/memoryX/state

Now you can use new memory.

Hot Remove memory

$ echo "offline" > /sys/device/sysstem/memory/memoryX/state