[PATCH 2/2] mm: consistently register / release memory resource

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

 



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@xxxxxxxxxxxxxxxx>
---
 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 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