[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 from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux