Hello Andrew On 12/04/2013 07:48 AM, Andrew Morton wrote: > On Tue, 03 Dec 2013 10:19:44 +0800 Zhang Yanfei <zhangyanfei@xxxxxxxxxxxxxx> wrote: > >> The current Linux cannot migrate pages used by the kerenl because >> of the kernel direct mapping. In Linux kernel space, va = pa + PAGE_OFFSET. >> When the pa is changed, we cannot simply update the pagetable and >> keep the va unmodified. So the kernel pages are not migratable. >> >> There are also some other issues will cause the kernel pages not migratable. >> For example, the physical address may be cached somewhere and will be used. >> It is not to update all the caches. >> >> When doing memory hotplug in Linux, we first migrate all the pages in one >> memory device somewhere else, and then remove the device. But if pages are >> used by the kernel, they are not migratable. As a result, memory used by >> the kernel cannot be hot-removed. >> >> Modifying the kernel direct mapping mechanism is too difficult to do. And >> it may cause the kernel performance down and unstable. So we use the following >> way to do memory hotplug. >> >> >> [What we are doing] >> >> In Linux, memory in one numa node is divided into several zones. One of the >> zones is ZONE_MOVABLE, which the kernel won't use. >> >> In order to implement memory hotplug in Linux, we are going to arrange all >> hotpluggable memory in ZONE_MOVABLE so that the kernel won't use these memory. > > How does the user enable this? I didn't spot a Kconfig variable which > enables it. Is there a boot option? Yeah, there is a Kconfig variable "MOVABLE_NODE" and a boot option "movable_node" mm/Kconfig config MOVABLE_NODE boolean "Enable to assign a node which has only movable memory" ...... default n help Allow a node to have only movable memory. Pages used by the kernel, such as direct mapping pages cannot be migrated. So the corresponding memory device cannot be hotplugged. This option allows the following two things: - When the system is booting, node full of hotpluggable memory can be arranged to have only movable memory so that the whole node can be hot-removed. (need movable_node boot option specified). - After the system is up, the option allows users to online all the memory of a node as movable memory so that the whole node can be hot-removed. Users who don't use the memory hotplug feature are fine with this option on since they don't specify movable_node boot option or they don't online memory as movable. Say Y here if you want to hotplug a whole node. Say N here if you want kernel to use memory on all nodes evenly. And the movable_node boot option in DOC: Documentation/kernel-parameters.txt movable_node [KNL,X86] Boot-time switch to *enable* the effects of CONFIG_MOVABLE_NODE=y. See mm/Kconfig for details. > > Or is it always enabled? If so, that seems incautious - if it breaks > in horrid ways we want people to be able to go back to the usual > behavior. > -- Thanks. Zhang Yanfei -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>