To use Memory Hotplug feature, you need
followings.
- Stock kernel source code,
or prepatch.
- Andrew Morton's -mm tree patch.
- -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
2. Kernel Configuration and Compile
Turn on these config options in
'Processor type and features' category to compile kernel.
- Allow nonlinear physical memory.
- Allow for memory hotplug. (Memory migration will turn on by this.)
- (Current -mhp patch need 'High Memory Support' option too.)
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.
- IA32/x86_64 : 128MB
- IA64/ppc64 : 256MB
(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