All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mm/acpi hotplug fixes for hot-remove
@ 2012-04-05 18:07 ` Vasilis Liaskovitis
  0 siblings, 0 replies; 6+ messages in thread
From: Vasilis Liaskovitis @ 2012-04-05 18:07 UTC (permalink / raw)
  To: linux-mm, linux-acpi; +Cc: Vasilis Liaskovitis

On memory hot-remove, the acpi_memhotplug driver currently offlines memory but
does not remove section mappings and sysfs entries. Additionally, memory
resource registration is done inconsistently on hot-add and hot-remove. This
series attempts to address the 2 issues.

(Note that testing memory hot-remove with SPARSEMEM_VMEMMAP=y will currently
fail, since freeing the sparse_vmemmap is not yet supported.)

Vasilis Liaskovitis (2):
  acpi: remove section mappings on memory hot-remove
  mm: consistently register / release memory resource

 drivers/acpi/acpi_memhotplug.c |   17 ++++++++++++++++-
 mm/memory_hotplug.c            |    4 ++--
 2 files changed, 18 insertions(+), 3 deletions(-)

-- 
1.7.9


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/2] mm/acpi hotplug fixes for hot-remove
@ 2012-04-05 18:07 ` Vasilis Liaskovitis
  0 siblings, 0 replies; 6+ messages in thread
From: Vasilis Liaskovitis @ 2012-04-05 18:07 UTC (permalink / raw)
  To: linux-mm, linux-acpi; +Cc: Vasilis Liaskovitis

On memory hot-remove, the acpi_memhotplug driver currently offlines memory but
does not remove section mappings and sysfs entries. Additionally, memory
resource registration is done inconsistently on hot-add and hot-remove. This
series attempts to address the 2 issues.

(Note that testing memory hot-remove with SPARSEMEM_VMEMMAP=y will currently
fail, since freeing the sparse_vmemmap is not yet supported.)

Vasilis Liaskovitis (2):
  acpi: remove section mappings on memory hot-remove
  mm: consistently register / release memory resource

 drivers/acpi/acpi_memhotplug.c |   17 ++++++++++++++++-
 mm/memory_hotplug.c            |    4 ++--
 2 files changed, 18 insertions(+), 3 deletions(-)

-- 
1.7.9

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] acpi: remove section mappings on memory hot-remove
  2012-04-05 18:07 ` Vasilis Liaskovitis
@ 2012-04-05 18:07   ` Vasilis Liaskovitis
  -1 siblings, 0 replies; 6+ messages in thread
From: Vasilis Liaskovitis @ 2012-04-05 18:07 UTC (permalink / raw)
  To: linux-mm, linux-acpi; +Cc: Vasilis Liaskovitis


Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
---
 drivers/acpi/acpi_memhotplug.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index d985713..75d33cd 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
+#include <linux/mm.h>
 #include <linux/memory_hotplug.h>
 #include <linux/slab.h>
 #include <acpi/acpi_drivers.h>
@@ -310,7 +311,8 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
 {
 	int result;
 	struct acpi_memory_info *info, *n;
-
+	int start_pfn, end_pfn;
+	struct zone *zone;
 
 	/*
 	 * Ask the VM to offline this memory range.
@@ -321,6 +323,19 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
 			result = remove_memory(info->start_addr, info->length);
 			if (result)
 				return result;
+			/*
+			 * Remove section mappings and sysfs entries for the
+			 * section of the memory we are removing.
+			 */
+
+			start_pfn = PFN_DOWN(info->start_addr);
+			end_pfn = start_pfn + PFN_DOWN(info->length);
+			zone = page_zone(pfn_to_page(start_pfn));
+			result = __remove_pages(zone, start_pfn,
+						end_pfn - start_pfn);
+			if (result)
+				return result;
+
 		}
 		kfree(info);
 	}
-- 
1.7.9


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 1/2] acpi: remove section mappings on memory hot-remove
@ 2012-04-05 18:07   ` Vasilis Liaskovitis
  0 siblings, 0 replies; 6+ messages in thread
From: Vasilis Liaskovitis @ 2012-04-05 18:07 UTC (permalink / raw)
  To: linux-mm, linux-acpi; +Cc: Vasilis Liaskovitis


Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
---
 drivers/acpi/acpi_memhotplug.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index d985713..75d33cd 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
+#include <linux/mm.h>
 #include <linux/memory_hotplug.h>
 #include <linux/slab.h>
 #include <acpi/acpi_drivers.h>
@@ -310,7 +311,8 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
 {
 	int result;
 	struct acpi_memory_info *info, *n;
-
+	int start_pfn, end_pfn;
+	struct zone *zone;
 
 	/*
 	 * Ask the VM to offline this memory range.
@@ -321,6 +323,19 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
 			result = remove_memory(info->start_addr, info->length);
 			if (result)
 				return result;
+			/*
+			 * Remove section mappings and sysfs entries for the
+			 * section of the memory we are removing.
+			 */
+
+			start_pfn = PFN_DOWN(info->start_addr);
+			end_pfn = start_pfn + PFN_DOWN(info->length);
+			zone = page_zone(pfn_to_page(start_pfn));
+			result = __remove_pages(zone, start_pfn,
+						end_pfn - start_pfn);
+			if (result)
+				return result;
+
 		}
 		kfree(info);
 	}
-- 
1.7.9

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] mm: consistently register / release memory resource
  2012-04-05 18:07 ` Vasilis Liaskovitis
@ 2012-04-05 18:07   ` Vasilis Liaskovitis
  -1 siblings, 0 replies; 6+ messages in thread
From: Vasilis Liaskovitis @ 2012-04-05 18:07 UTC (permalink / raw)
  To: linux-mm, linux-acpi; +Cc: Vasilis Liaskovitis

add_memory() registers hotplugged memory resources by calling
register_memory_resource() for the whole memory range requested.
However, __remove_pages() releases memory resources by calling
release_memory_region on a per section basis. This discrepancy
can break memory hotplug operations when using memory devices
that span multiple sections. Specifically hot-readd
(hot-add/hot-remove/hot-add sequence) will not work. Fix by releasing
the memory resource as a whole (another option would be to register
and release always on a per section basis).

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
---
 mm/memory_hotplug.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 6629faf..8ab6b63 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -362,12 +362,12 @@ int __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
 	sections_to_remove = nr_pages / PAGES_PER_SECTION;
 	for (i = 0; i < sections_to_remove; i++) {
 		unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION;
-		release_mem_region(pfn << PAGE_SHIFT,
-				   PAGES_PER_SECTION << PAGE_SHIFT);
 		ret = __remove_section(zone, __pfn_to_section(pfn));
 		if (ret)
 			break;
 	}
+	release_mem_region(phys_start_pfn << PAGE_SHIFT,
+			nr_pages << PAGE_SHIFT);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(__remove_pages);
-- 
1.7.9


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] mm: consistently register / release memory resource
@ 2012-04-05 18:07   ` Vasilis Liaskovitis
  0 siblings, 0 replies; 6+ messages in thread
From: Vasilis Liaskovitis @ 2012-04-05 18:07 UTC (permalink / raw)
  To: linux-mm, linux-acpi; +Cc: Vasilis Liaskovitis

add_memory() registers hotplugged memory resources by calling
register_memory_resource() for the whole memory range requested.
However, __remove_pages() releases memory resources by calling
release_memory_region on a per section basis. This discrepancy
can break memory hotplug operations when using memory devices
that span multiple sections. Specifically hot-readd
(hot-add/hot-remove/hot-add sequence) will not work. Fix by releasing
the memory resource as a whole (another option would be to register
and release always on a per section basis).

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
---
 mm/memory_hotplug.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 6629faf..8ab6b63 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -362,12 +362,12 @@ int __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
 	sections_to_remove = nr_pages / PAGES_PER_SECTION;
 	for (i = 0; i < sections_to_remove; i++) {
 		unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION;
-		release_mem_region(pfn << PAGE_SHIFT,
-				   PAGES_PER_SECTION << PAGE_SHIFT);
 		ret = __remove_section(zone, __pfn_to_section(pfn));
 		if (ret)
 			break;
 	}
+	release_mem_region(phys_start_pfn << PAGE_SHIFT,
+			nr_pages << PAGE_SHIFT);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(__remove_pages);
-- 
1.7.9

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-04-05 18:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-05 18:07 [PATCH 0/2] mm/acpi hotplug fixes for hot-remove Vasilis Liaskovitis
2012-04-05 18:07 ` Vasilis Liaskovitis
2012-04-05 18:07 ` [PATCH 1/2] acpi: remove section mappings on memory hot-remove Vasilis Liaskovitis
2012-04-05 18:07   ` Vasilis Liaskovitis
2012-04-05 18:07 ` [PATCH 2/2] mm: consistently register / release memory resource Vasilis Liaskovitis
2012-04-05 18:07   ` Vasilis Liaskovitis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.