aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/mm/init.c17
-rw-r--r--arch/powerpc/mm/mem.c17
-rw-r--r--arch/s390/mm/init.c11
-rw-r--r--mm/memory_hotplug.c12
4 files changed, 11 insertions, 46 deletions
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index f482a9098e32..054bcd9439aa 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -700,23 +700,6 @@ int arch_add_memory(int nid, u64 start, u64 size)
700 700
701 return ret; 701 return ret;
702} 702}
703#ifdef CONFIG_MEMORY_HOTREMOVE
704int remove_memory(u64 start, u64 size)
705{
706 unsigned long start_pfn, end_pfn;
707 unsigned long timeout = 120 * HZ;
708 int ret;
709 start_pfn = start >> PAGE_SHIFT;
710 end_pfn = start_pfn + (size >> PAGE_SHIFT);
711 ret = offline_pages(start_pfn, end_pfn, timeout);
712 if (ret)
713 goto out;
714 /* we can free mem_map at this point */
715out:
716 return ret;
717}
718EXPORT_SYMBOL_GPL(remove_memory);
719#endif /* CONFIG_MEMORY_HOTREMOVE */
720#endif 703#endif
721 704
722/* 705/*
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 98d7bf99533a..b9e1a1da6e52 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -134,23 +134,6 @@ int arch_add_memory(int nid, u64 start, u64 size)
134 134
135 return __add_pages(zone, start_pfn, nr_pages); 135 return __add_pages(zone, start_pfn, nr_pages);
136} 136}
137
138#ifdef CONFIG_MEMORY_HOTREMOVE
139int remove_memory(u64 start, u64 size)
140{
141 unsigned long start_pfn, end_pfn;
142 int ret;
143
144 start_pfn = start >> PAGE_SHIFT;
145 end_pfn = start_pfn + (size >> PAGE_SHIFT);
146 ret = offline_pages(start_pfn, end_pfn, 120 * HZ);
147 if (ret)
148 goto out;
149 /* Arch-specific calls go here - next patch */
150out:
151 return ret;
152}
153#endif /* CONFIG_MEMORY_HOTREMOVE */
154#endif /* CONFIG_MEMORY_HOTPLUG */ 137#endif /* CONFIG_MEMORY_HOTPLUG */
155 138
156/* 139/*
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 1169130a97ef..158b0d6d7046 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -189,14 +189,3 @@ int arch_add_memory(int nid, u64 start, u64 size)
189 return rc; 189 return rc;
190} 190}
191#endif /* CONFIG_MEMORY_HOTPLUG */ 191#endif /* CONFIG_MEMORY_HOTPLUG */
192
193#ifdef CONFIG_MEMORY_HOTREMOVE
194int remove_memory(u64 start, u64 size)
195{
196 unsigned long start_pfn, end_pfn;
197
198 start_pfn = PFN_DOWN(start);
199 end_pfn = start_pfn + PFN_DOWN(size);
200 return offline_pages(start_pfn, end_pfn, 120 * HZ);
201}
202#endif /* CONFIG_MEMORY_HOTREMOVE */
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 89fee2dcb039..c299d083d8e2 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -26,6 +26,7 @@
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/migrate.h> 27#include <linux/migrate.h>
28#include <linux/page-isolation.h> 28#include <linux/page-isolation.h>
29#include <linux/pfn.h>
29 30
30#include <asm/tlbflush.h> 31#include <asm/tlbflush.h>
31 32
@@ -849,10 +850,19 @@ failed_removal:
849 850
850 return ret; 851 return ret;
851} 852}
853
854int remove_memory(u64 start, u64 size)
855{
856 unsigned long start_pfn, end_pfn;
857
858 start_pfn = PFN_DOWN(start);
859 end_pfn = start_pfn + PFN_DOWN(size);
860 return offline_pages(start_pfn, end_pfn, 120 * HZ);
861}
852#else 862#else
853int remove_memory(u64 start, u64 size) 863int remove_memory(u64 start, u64 size)
854{ 864{
855 return -EINVAL; 865 return -EINVAL;
856} 866}
857EXPORT_SYMBOL_GPL(remove_memory);
858#endif /* CONFIG_MEMORY_HOTREMOVE */ 867#endif /* CONFIG_MEMORY_HOTREMOVE */
868EXPORT_SYMBOL_GPL(remove_memory);