[PATCH v2 03/12] memory-hotplug: remove redundant codes

2012-10-23 Thread wency
From: Wen Congyang we...@cn.fujitsu.com offlining memory blocks and checking whether memory blocks are offlined are very similar. This patch introduces a new function to remove redundant codes. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown

[PATCH v2 01/12] memory-hotplug: try to offline the memory twice to avoid dependence

2012-10-23 Thread wency
From: Wen Congyang we...@cn.fujitsu.com memory can't be offlined when CONFIG_MEMCG is selected. For example: there is a memory device on node 1. The address range is [1G, 1.5G). You will find 4 new directories memory8, memory9, memory10, and memory11 under the directory

[PATCH v2 02/12] memory-hotplug: check whether all memory blocks are offlined or not when removing memory

2012-10-23 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com We remove the memory like this: 1. lock memory hotplug 2. offline a memory block 3. unlock memory hotplug 4. repeat 1-3 to offline all memory blocks 5. lock memory hotplug 6. remove memory(TODO) 7. unlock memory hotplug All memory blocks

[PATCH v2 04/12] memory-hotplug: remove /sys/firmware/memmap/X sysfs

2012-10-23 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type} sysfs files are created. But there is no code to remove these files. The patch implements the function to remove them. Note: The code does not free

[PATCH v2 05/12] memory-hotplug: introduce new function arch_remove_memory() for removing page table depends on architecture

2012-10-23 Thread wency
From: Wen Congyang we...@cn.fujitsu.com For removing memory, we need to remove page table. But it depends on architecture. So the patch introduce arch_remove_memory() for removing page table. Now it only calls __remove_pages(). Note: __remove_pages() for some archtecuture is not implemented

[PATCH v2 06/12] memory-hotplug: unregister memory section on SPARSEMEM_VMEMMAP

2012-10-23 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com Currently __remove_section for SPARSEMEM_VMEMMAP does nothing. But even if we use SPARSEMEM_VMEMMAP, we can unregister the memory_section. So the patch add unregister_memory_section() into __remove_section(). CC: David Rientjes

[PATCH v2 07/12] memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap

2012-10-23 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com For removing memmap region of sparse-vmemmap which is allocated bootmem, memmap region of sparse-vmemmap needs to be registered by get_page_bootmem(). So the patch searches pages of virtual mapping and registers the pages by

[PATCH v2 08/12] memory-hotplug: remove memmap of sparse-vmemmap

2012-10-23 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com All pages of virtual mapping in removed memory cannot be freed, since some pages used as PGD/PUD includes not only removed memory but also other memory. So the patch checks whether page can be freed or not. How to check whether page can be

[PATCH v2 00/12] memory-hotplug: hot-remove physical memory

2012-10-23 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The patch-set was divided from following thread's patch-set. https://lkml.org/lkml/2012/9/5/201 The last version of this patchset: https://lkml.org/lkml/2012/10/5/469 If you want to know the reason, please read following thread.

[PATCH v2 12/12] memory-hotplug: free node_data when a node is offlined

2012-10-23 Thread wency
From: Wen Congyang we...@cn.fujitsu.com We call hotadd_new_pgdat() to allocate memory to store node_data. So we should free it when removing a node. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt

[PATCH v2 11/12] memory-hotplug: remove sysfs file of node

2012-10-23 Thread wency
From: Wen Congyang we...@cn.fujitsu.com This patch introduces a new function try_offline_node() to remove sysfs file of node when all memory sections of this node are removed. If some memory sections of this node are not removed, this function does nothing. CC: David Rientjes rient...@google.com

[PATCH v2 09/12] memory-hotplug: remove page table of x86_64 architecture

2012-10-23 Thread wency
From: Wen Congyang we...@cn.fujitsu.com For hot removing memory, we sholud remove page table about the memory. So the patch searches a page table about the removed memory, and clear page table. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown

[PATCH v2 10/12] memory-hotplug: memory_hotplug: clear zone when removing the memory

2012-10-23 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When a memory is added, we update zone's and pgdat's start_pfn and spanned_pages in the function __add_zone(). So we should revert them when the memory is removed. The patch adds a new function __remove_zone() to do this. CC: David Rientjes

[RFC v9 PATCH 07/21] memory-hotplug: call acpi_bus_remove() to remove memory device

2012-09-05 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The memory device has been ejected and powoffed, so we can call acpi_bus_remove() to remove the memory device from acpi bus. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt

[RFC v9 PATCH 03/21] memory-hotplug: store the node id in acpi_memory_device

2012-09-05 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The memory device has only one node id. Store the node id when enable the memory device, and we can reuse it when removing the memory device. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC:

[RFC v9 PATCH 09/21] memory-hotplug: does not release memory region in PAGES_PER_SECTION chunks

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com Since applying a patch(de7f0cba96786c), release_mem_region() has been changed as called in PAGES_PER_SECTION chunks because register_memory_resource() is called in PAGES_PER_SECTION chunks by add_memory(). But it seems firmware dependency. If

[RFC v9 PATCH 01/21] memory-hotplug: rename remove_memory() to offline_memory()/offline_pages()

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com remove_memory() only try to offline pages. It is called in two cases: 1. hot remove a memory device 2. echo offline /sys/devices/system/memory/memoryXX/state In the 1st case, we should also change memory block's state, and notify the

[RFC v9 PATCH 00/21] memory-hotplug: hot-remove physical memory

2012-09-05 Thread wency
From: Wen Congyang we...@cn.fujitsu.com This patch series aims to support physical memory hot-remove. The patches can free/remove the following things: - acpi_memory_info : [RFC PATCH 4/19] - /sys/firmware/memmap/X/{end, start, type} : [RFC PATCH 8/19] -

[RFC v9 PATCH 08/21] memory-hotplug: remove /sys/firmware/memmap/X sysfs

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type} sysfs files are created. But there is no code to remove these files. The patch implements the function to remove them. Note : The code does not free

[RFC v9 PATCH 06/21] memory-hotplug: export the function acpi_bus_remove()

2012-09-05 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The function acpi_bus_remove() can remove a acpi device from acpi device. When a acpi device is removed, we need to call this function to remove the acpi device from acpi bus. So export this function. CC: David Rientjes rient...@google.com CC: Jiang Liu

[RFC v9 PATCH 05/21] memory-hotplug: check whether memory is present or not

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com If system supports memory hot-remove, online_pages() may online removed pages. So online_pages() need to check whether onlining pages are present or not. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown

[RFC v9 PATCH 04/21] memory-hotplug: offline and remove memory when removing the memory device

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com We should offline and remove memory when removing the memory device. The memory device can be removed by 2 ways: 1. send eject request by SCI 2. echo 1 /sys/bus/pci/devices/PNP0C80:XX/eject In the 1st case, acpi_memory_disable_device() will

[RFC v9 PATCH 02/21] memory-hotplug: implement offline_memory()

2012-09-05 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The function offline_memory() will be called when hot removing a memory device. The memory device may contain more than one memory block. If the memory block has been offlined, __offline_pages() will fail. So we should try to offline one memory block at a

[RFC v9 PATCH 20/21] memory-hotplug: clear hwpoisoned flag when onlining pages

2012-09-05 Thread wency
From: Wen Congyang we...@cn.fujitsu.com hwpoisoned may set when we offline a page by the sysfs interface /sys/devices/system/memory/soft_offline_page or /sys/devices/system/memory/hard_offline_page. If we don't clear this flag when onlining pages, this page can't be freed, and will not in free

[RFC v9 PATCH 15/21] memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com For removing memmap region of sparse-vmemmap which is allocated bootmem, memmap region of sparse-vmemmap needs to be registered by get_page_bootmem(). So the patch searches pages of virtual mapping and registers the pages by

[RFC v9 PATCH 21/21] memory-hotplug: auto offline page_cgroup when onlining memory block failed

2012-09-05 Thread wency
From: Wen Congyang we...@cn.fujitsu.com When a memory block is onlined, we will try allocate memory on that node to store page_cgroup. If onlining the memory block failed, we don't offline the page cgroup, and we have no chance to offline this page cgroup unless the memory block is onlined

[RFC v9 PATCH 13/21] memory-hotplug: check page type in get_page_bootmem

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com The function get_page_bootmem() may be called more than one time to the same page. There is no need to set page's type, private if the function is not the first time called to the page. Note: the patch is just optimization and does not fix

[RFC v9 PATCH 10/21] memory-hotplug: add memory_block_release

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When calling remove_memory_block(), the function shows following message at device_release(). Device 'memory528' does not have a release() function, it is broken and must be fixed. remove_memory_block() calls kfree(mem). I think it shouled

[RFC v9 PATCH 19/21] memory-hotplug: remove sysfs file of node

2012-09-05 Thread wency
From: Wen Congyang we...@cn.fujitsu.com This patch introduces a new function try_offline_node() to remove sysfs file of node when all memory sections of this node are removed. If some memory sections of this node are not removed, this function does nothing. CC: David Rientjes rient...@google.com

[RFC v9 PATCH 14/21] memory-hotplug: move register_page_bootmem_info_node and put_page_bootmem for sparse-vmemmap

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com For implementing register_page_bootmem_info_node of sparse-vmemmap, register_page_bootmem_info_node and put_page_bootmem are moved to memory_hotplug.c CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown

[RFC v9 PATCH 11/21] memory-hotplug: remove_memory calls __remove_pages

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com The patch adds __remove_pages() to remove_memory(). Then the range of phys_start_pfn argument and nr_pages argument in __remove_pagse() may have different zone. So zone argument is removed from __remove_pages() and __remove_pages()

[RFC v9 PATCH 17/21] memory_hotplug: clear zone when the memory is removed

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When a memory is added, we update zone's and pgdat's start_pfn and spanned_pages in the function __add_zone(). So we should revert these when the memory is removed. Add a new function __remove_zone() to do this. CC: David Rientjes

[RFC v9 PATCH 16/21] memory-hotplug: free memmap of sparse-vmemmap

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com All pages of virtual mapping in removed memory cannot be freed, since some pages used as PGD/PUD includes not only removed memory but also other memory. So the patch checks whether page can be freed or not. How to check whether page can be

[RFC v9 PATCH 12/21] memory-hotplug: introduce new function arch_remove_memory()

2012-09-05 Thread wency
From: Wen Congyang we...@cn.fujitsu.com We don't call __add_pages() directly in the function add_memory() because some other architecture related things need to be done before or after calling __add_pages(). So we should introduce a new function arch_remove_memory() to revert the things done in

[RFC v9 PATCH 18/21] memory-hotplug: add node_device_release

2012-09-05 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When calling unregister_node(), the function shows following message at device_release(). Device 'node2' does not have a release() function, it is broken and must be fixed. So the patch implements node_device_release() CC: David Rientjes

[RFC v8 PATCH 07/20] memory-hotplug: call acpi_bus_remove() to remove memory device

2012-08-28 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The memory device has been ejected and powoffed, so we can call acpi_bus_remove() to remove the memory device from acpi bus. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt

[RFC v8 PATCH 20/20] memory-hotplug: clear hwpoisoned flag when onlining pages

2012-08-28 Thread wency
From: Wen Congyang we...@cn.fujitsu.com hwpoisoned may set when we offline a page by the sysfs interface /sys/devices/system/memory/soft_offline_page or /sys/devices/system/memory/hard_offline_page. If we don't clear this flag when onlining pages, this page can't be freed, and will not in free

[RFC v8 PATCH 03/20] memory-hotplug: store the node id in acpi_memory_device

2012-08-28 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The memory device has only one node id. Store the node id when enable the memory device, and we can reuse it when removing the memory device. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC:

[RFC v8 PATCH 13/20] memory-hotplug: check page type in get_page_bootmem

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com There is a possibility that get_page_bootmem() is called to the same page many times. So when get_page_bootmem is called to the same page, the function only increments page-_count. CC: David Rientjes rient...@google.com CC: Jiang Liu

[RFC v8 PATCH 18/20] memory-hotplug: add node_device_release

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When calling unregister_node(), the function shows following message at device_release(). Device 'node2' does not have a release() function, it is broken and must be fixed. So the patch implements node_device_release() CC: David Rientjes

[RFC v8 PATCH 10/20] memory-hotplug: add memory_block_release

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When calling remove_memory_block(), the function shows following message at device_release(). Device 'memory528' does not have a release() function, it is broken and must be fixed. remove_memory_block() calls kfree(mem). I think it shouled

[RFC v8 PATCH 19/20] memory-hotplug: remove sysfs file of node

2012-08-28 Thread wency
From: Wen Congyang we...@cn.fujitsu.com This patch introduces a new function try_offline_node() to remove sysfs file of node when all memory sections of this node are removed. If some memory sections of this node are not removed, this function does nothing. CC: David Rientjes rient...@google.com

[RFC v8 PATCH 06/20] memory-hotplug: export the function acpi_bus_remove()

2012-08-28 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The function acpi_bus_remove() can remove a acpi device from acpi device. When a acpi device is removed, we need to call this function to remove the acpi device from acpi bus. So export this function. CC: David Rientjes rient...@google.com CC: Jiang Liu

[RFC v8 PATCH 05/20] memory-hotplug: check whether memory is present or not

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com If system supports memory hot-remove, online_pages() may online removed pages. So online_pages() need to check whether onlining pages are present or not. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown

[RFC v8 PATCH 09/20] memory-hotplug: does not release memory region in PAGES_PER_SECTION chunks

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com Since applying a patch(de7f0cba96786c), release_mem_region() has been changed as called in PAGES_PER_SECTION chunks because register_memory_resource() is called in PAGES_PER_SECTION chunks by add_memory(). But it seems firmware dependency. If

[RFC v8 PATCH 14/20] memory-hotplug: move register_page_bootmem_info_node and put_page_bootmem for sparse-vmemmap

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com For implementing register_page_bootmem_info_node of sparse-vmemmap, register_page_bootmem_info_node and put_page_bootmem are moved to memory_hotplug.c CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown

[RFC v8 PATCH 11/20] memory-hotplug: remove_memory calls __remove_pages

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com The patch adds __remove_pages() to remove_memory(). Then the range of phys_start_pfn argument and nr_pages argument in __remove_pagse() may have different zone. So zone argument is removed from __remove_pages() and __remove_pages()

[RFC v8 PATCH 01/20] memory-hotplug: rename remove_memory() to offline_memory()/offline_pages()

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com remove_memory() only try to offline pages. It is called in two cases: 1. hot remove a memory device 2. echo offline /sys/devices/system/memory/memoryXX/state In the 1st case, we should also change memory block's state, and notify the

[RFC v8 PATCH 08/20] memory-hotplug: remove /sys/firmware/memmap/X sysfs

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type} sysfs files are created. But there is no code to remove these files. The patch implements the function to remove them. Note : The code does not free

[RFC v8 PATCH 00/20] memory-hotplug: hot-remove physical memory

2012-08-28 Thread wency
From: Wen Congyang we...@cn.fujitsu.com This patch series aims to support physical memory hot-remove. The patches can free/remove the following things: - acpi_memory_info : [RFC PATCH 4/19] - /sys/firmware/memmap/X/{end, start, type} : [RFC PATCH 8/19] -

[RFC v8 PATCH 17/20] memory_hotplug: clear zone when the memory is removed

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When a memory is added, we update zone's and pgdat's start_pfn and spanned_pages in the function __add_zone(). So we should revert these when the memory is removed. Add a new function __remove_zone() to do this. CC: David Rientjes

[RFC v8 PATCH 15/20] memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com For removing memmap region of sparse-vmemmap which is allocated bootmem, memmap region of sparse-vmemmap needs to be registered by get_page_bootmem(). So the patch searches pages of virtual mapping and registers the pages by

[RFC v8 PATCH 16/20] memory-hotplug: free memmap of sparse-vmemmap

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com All pages of virtual mapping in removed memory cannot be freed, since some pages used as PGD/PUD includes not only removed memory but also other memory. So the patch checks whether page can be freed or not. How to check whether page can be

[RFC v8 PATCH 12/20] memory-hotplug: introduce new function arch_remove_memory()

2012-08-28 Thread wency
From: Wen Congyang we...@cn.fujitsu.com We don't call __add_pages() directly in the function add_memory() because some other architecture related things need to be done before or after calling __add_pages(). So we should introduce a new function arch_remove_memory() to revert the things done in

[RFC v8 PATCH 02/20] memory-hotplug: implement offline_memory()

2012-08-28 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The function offline_memory() will be called when hot removing a memory device. The memory device may contain more than one memory block. If the memory block has been offlined, __offline_pages() will fail. So we should try to offline one memory block at a

[RFC v8 PATCH 04/20] memory-hotplug: offline and remove memory when removing the memory device

2012-08-28 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com We should offline and remove memory when removing the memory device. The memory device can be removed by 2 ways: 1. send eject request by SCI 2. echo 1 /sys/bus/pci/devices/PNP0C80:XX/eject In the 1st case, acpi_memory_disable_device() will

[RFC V7 PATCH 05/19] memory-hotplug: check whether memory is present or not

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com If system supports memory hot-remove, online_pages() may online removed pages. So online_pages() need to check whether onlining pages are present or not. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown

[RFC V7 PATCH 06/19] memory-hotplug: export the function acpi_bus_remove()

2012-08-20 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The function acpi_bus_remove() can remove a acpi device from acpi device. When a acpi device is removed, we need to call this function to remove the acpi device from acpi bus. So export this function. CC: David Rientjes rient...@google.com CC: Jiang Liu

[RFC V7 PATCH 00/19] memory-hotplug: hot-remove physical memory

2012-08-20 Thread wency
From: Wen Congyang we...@cn.fujitsu.com This patch series aims to support physical memory hot-remove. The patches can free/remove the following things: - acpi_memory_info : [RFC PATCH 4/19] - /sys/firmware/memmap/X/{end, start, type} : [RFC PATCH 8/19] -

[RFC V7 PATCH 02/19] memory-hotplug: implement offline_memory()

2012-08-20 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The function offline_memory() will be called when hot removing a memory device. The memory device may contain more than one memory block. If the memory block has been offlined, __offline_pages() will fail. So we should try to offline one memory block at a

[RFC V7 PATCH 01/19] memory-hotplug: rename remove_memory() to offline_memory()/offline_pages()

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com remove_memory() only try to offline pages. It is called in two cases: 1. hot remove a memory device 2. echo offline /sys/devices/system/memory/memoryXX/state In the 1st case, we should also change memory block's state, and notify the

[RFC V7 PATCH 03/19] memory-hotplug: store the node id in acpi_memory_device

2012-08-20 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The memory device has only one node id. Store the node id when enable the memory device, and we can reuse it when removing the memory device. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC:

[RFC V7 PATCH 04/19] memory-hotplug: offline and remove memory when removing the memory device

2012-08-20 Thread wency
From: Wen Congyang we...@cn.fujitsu.com We should offline and remove memory when removing the memory device. The memory device can be removed by 2 ways: 1. send eject request by SCI 2. echo 1 /sys/bus/pci/devices/PNP0C80:XX/eject In the 1st case, acpi_memory_disable_device() will be called. In

[RFC V7 PATCH 09/19] memory-hotplug: does not release memory region in PAGES_PER_SECTION chunks

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com Since applying a patch(de7f0cba96786c), release_mem_region() has been changed as called in PAGES_PER_SECTION chunks because register_memory_resource() is called in PAGES_PER_SECTION chunks by add_memory(). But it seems firmware dependency. If

[RFC V7 PATCH 10/19] memory-hotplug: add memory_block_release

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When calling remove_memory_block(), the function shows following message at device_release(). Device 'memory528' does not have a release() function, it is broken and must be fixed. remove_memory_block() calls kfree(mem). I think it shouled

[RFC V7 PATCH 07/19] memory-hotplug: call acpi_bus_remove() to remove memory device

2012-08-20 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The memory device has been ejected and powoffed, so we can call acpi_bus_remove() to remove the memory device from acpi bus. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt

[RFC V7 PATCH 11/19] memory-hotplug: remove_memory calls __remove_pages

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com The patch adds __remove_pages() to remove_memory(). Then the range of phys_start_pfn argument and nr_pages argument in __remove_pagse() may have different zone. So zone argument is removed from __remove_pages() and __remove_pages()

[RFC V7 PATCH 15/19] memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com For removing memmap region of sparse-vmemmap which is allocated bootmem, memmap region of sparse-vmemmap needs to be registered by get_page_bootmem(). So the patch searches pages of virtual mapping and registers the pages by

[RFC V7 PATCH 12/19] memory-hotplug: introduce new function arch_remove_memory()

2012-08-20 Thread wency
From: Wen Congyang we...@cn.fujitsu.com We don't call __add_pages() directly in the function add_memory() because some other architecture related things need to be done before or after calling __add_pages(). So we should introduce a new function arch_remove_memory() to revert the things done in

[RFC V7 PATCH 14/19] memory-hotplug: move register_page_bootmem_info_node and put_page_bootmem for sparse-vmemmap

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com For implementing register_page_bootmem_info_node of sparse-vmemmap, register_page_bootmem_info_node and put_page_bootmem are moved to memory_hotplug.c CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown

[RFC V7 PATCH 08/19] memory-hotplug: remove /sys/firmware/memmap/X sysfs

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type} sysfs files are created. But there is no code to remove these files. The patch implements the function to remove them. Note : The code does not free

[RFC V7 PATCH 13/19] memory-hotplug: check page type in get_page_bootmem

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com There is a possibility that get_page_bootmem() is called to the same page many times. So when get_page_bootmem is called to the same page, the function only increments page-_count. CC: David Rientjes rient...@google.com CC: Jiang Liu

[RFC V7 PATCH 18/19] memory-hotplug: add node_device_release

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When calling unregister_node(), the function shows following message at device_release(). Device 'node2' does not have a release() function, it is broken and must be fixed. So the patch implements node_device_release() CC: David Rientjes

[RFC V7 PATCH 16/19] memory-hotplug: free memmap of sparse-vmemmap

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com All pages of virtual mapping in removed memory cannot be freed, since some pages used as PGD/PUD includes not only removed memory but also other memory. So the patch checks whether page can be freed or not. How to check whether page can be

[RFC V7 PATCH 17/19] memory_hotplug: clear zone when the memory is removed

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When a memory is added, we update zone's and pgdat's start_pfn and spanned_pages in the function __add_zone(). So we should revert these when the memory is removed. Add a new function __remove_zone() to do this. CC: David Rientjes

[RFC V7 PATCH 19/19] memory-hotplug: remove sysfs file of node

2012-08-20 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com The patch adds node_set_offline() and unregister_one_node() to remove_memory() for removing sysfs file of node. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin

[RFC PATCH V6 00/19] memory-hotplug: hot-remove physical memory

2012-08-03 Thread wency
From: Wen Congyang we...@cn.fujitsu.com This patch series aims to support physical memory hot-remove. The patches can free/remove following things: - acpi_memory_info : [RFC PATCH 4/19] - /sys/firmware/memmap/X/{end, start, type} : [RFC PATCH 8/19] -

[RFC PATCH V6 01/19] memory-hotplug: rename remove_memory() to offline_memory()/offline_pages()

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com remove_memory() only try to offline pages. It is called in two cases: 1. hot remove a memory device 2. echo offline /sys/devices/system/memory/memoryXX/state In the 1st case, we should also change memory block's state, and notify the

[RFC PATCH V6 06/19] memory-hotplug: export the function acpi_bus_remove()

2012-08-03 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The function acpi_bus_remove() can remove a acpi device from acpi device. When a acpi device is removed, we need to call this function to remove the acpi device from acpi bus. So export this function. CC: David Rientjes rient...@google.com CC: Jiang Liu

[RFC PATCH V6 04/19] memory-hotplug: offline and remove memory when removing the memory device

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com We should offline and remove memory when removing the memory device. The memory device can be removed by 2 ways: 1. send eject request by SCI 2. echo 1 /sys/bus/pci/devices/PNP0C80:XX/eject In the 1st case, acpi_memory_disable_device() will

[RFC PATCH V6 05/19] memory-hotplug: check whether memory is present or not

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com If system supports memory hot-remove, online_pages() may online removed pages. So online_pages() need to check whether onlining pages are present or not. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown

[RFC PATCH V6 07/19] memory-hotplug: call acpi_bus_remove() to remove memory device

2012-08-03 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The memory device has been ejected and powoffed, so we can call acpi_bus_remove() to remove the memory device from acpi bus. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt

[RFC PATCH V6 02/19] memory-hotplug: implement offline_memory()

2012-08-03 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The function offline_memory() will be called when hot removing a memory device. The memory device may contain more than one memory block. If the memory block has been offlined, __offline_pages() will fail. So we should try to offline one memory block at a

[RFC PATCH V6 03/19] memory-hotplug: store the node id in acpi_memory_device

2012-08-03 Thread wency
From: Wen Congyang we...@cn.fujitsu.com The memory device has only one node id. Store the node id when enable the memory device, and we can reuse it when removing the memory device. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC:

[RFC PATCH V6 09/19] memory-hotplug: does not release memory region in PAGES_PER_SECTION chunks

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com Since applying a patch(de7f0cba96786c), release_mem_region() has been changed as called in PAGES_PER_SECTION chunks because register_memory_resource() is called in PAGES_PER_SECTION chunks by add_memory(). But it seems firmware dependency. If

[RFC PATCH V6 08/19] memory-hotplug: remove /sys/firmware/memmap/X sysfs

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type} sysfs files are created. But there is no code to remove these files. The patch implements the function to remove them. Note : The code does not free

[RFC PATCH V6 11/19] memory-hotplug: remove_memory calls __remove_pages

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com The patch adds __remove_pages() to remove_memory(). Then the range of phys_start_pfn argument and nr_pages argument in __remove_pagse() may have different zone. So zone argument is removed from __remove_pages() and __remove_pages()

[RFC PATCH V6 18/19] memory-hotplug: add node_device_release

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When calling unregister_node(), the function shows following message at device_release(). Device 'node2' does not have a release() function, it is broken and must be fixed. So the patch implements node_device_release() CC: David Rientjes

[RFC PATCH V6 19/19] memory-hotplug: remove sysfs file of node

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com The patch adds node_set_offline() and unregister_one_node() to remove_memory() for removing sysfs file of node. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin

[RFC PATCH V6 17/19] memory_hotplug: clear zone when the memory is removed

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When a memory is added, we update zone's and pgdat's start_pfn and spanned_pages in the function __add_zone(). So we should revert these when the memory is removed. Add a new function __remove_zone() to do this. CC: David Rientjes

[RFC PATCH V6 13/19] memory-hotplug: check page type in get_page_bootmem

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com There is a possibility that get_page_bootmem() is called to the same page many times. So when get_page_bootmem is called to the same page, the function only increments page-_count. CC: David Rientjes rient...@google.com CC: Jiang Liu

[RFC PATCH V6 14/19] memory-hotplug: move register_page_bootmem_info_node and put_page_bootmem for sparse-vmemmap

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com For implementing register_page_bootmem_info_node of sparse-vmemmap, register_page_bootmem_info_node and put_page_bootmem are moved to memory_hotplug.c CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown

[RFC PATCH V6 15/19] memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com For removing memmap region of sparse-vmemmap which is allocated bootmem, memmap region of sparse-vmemmap needs to be registered by get_page_bootmem(). So the patch searches pages of virtual mapping and registers the pages by

[RFC PATCH V6 16/19] memory-hotplug: free memmap of sparse-vmemmap

2012-08-03 Thread wency
From: Wen Congyang we...@cn.fujitsu.com All pages of virtual mapping in removed memory cannot be freed, since some pages used as PGD/PUD includes not only removed memory but also other memory. So the patch checks whether page can be freed or not. How to check whether page can be freed or not?

[RFC PATCH V6 10/19] memory-hotplug: add memory_block_release

2012-08-03 Thread wency
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com When calling remove_memory_block(), the function shows following message at device_release(). Device 'memory528' does not have a release() function, it is broken and must be fixed. remove_memory_block() calls kfree(mem). I think it shouled

[RFC PATCH V6 12/19] memory-hotplug: introduce new function arch_remove_memory()

2012-08-03 Thread wency
From: Wen Congyang we...@cn.fujitsu.com We don't call __add_pages() directly in the function add_memory() because some other architecture related things need to be done before or after calling __add_pages(). So we should introduce a new function arch_remove_memory() to revert the things done in