[PATCH 1/2] acpi: remove section mappings on memory hot-remove

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@xxxxxxxxxxxxxxxx>
---
 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@xxxxxxxxx.  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@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]