diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-06-06 22:32:52 -0400 |
---|---|---|
committer | Paul Mundt <lethal@hera.kernel.org> | 2007-06-07 22:43:51 -0400 |
commit | 33d63bd83bf9aa6b662a376a96b825acba721e8f (patch) | |
tree | 469eadf218a6e435b06eb151c88340c0adb7b83e | |
parent | 05a117847b43d44f336bbf272a1063661431a5e5 (diff) |
sh: memory hot-add for sparsemem users support.
This enables simple hotplug support for sparsemem users. Presently
this only permits memory being added in to node 0 on ZONE_NORMAL.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/mm/Kconfig | 8 | ||||
-rw-r--r-- | arch/sh/mm/init.c | 42 | ||||
-rw-r--r-- | mm/Kconfig | 2 |
3 files changed, 51 insertions, 1 deletions
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig index c713d13fcca9..0c24abdd4ea1 100644 --- a/arch/sh/mm/Kconfig +++ b/arch/sh/mm/Kconfig | |||
@@ -331,6 +331,14 @@ config ARCH_POPULATES_NODE_MAP | |||
331 | config ARCH_SELECT_MEMORY_MODEL | 331 | config ARCH_SELECT_MEMORY_MODEL |
332 | def_bool y | 332 | def_bool y |
333 | 333 | ||
334 | config ARCH_ENABLE_MEMORY_HOTPLUG | ||
335 | def_bool y | ||
336 | depends on SPARSEMEM | ||
337 | |||
338 | config ARCH_MEMORY_PROBE | ||
339 | def_bool y | ||
340 | depends on MEMORY_HOTPLUG | ||
341 | |||
334 | choice | 342 | choice |
335 | prompt "Kernel page size" | 343 | prompt "Kernel page size" |
336 | default PAGE_SIZE_4KB | 344 | default PAGE_SIZE_4KB |
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 753e11d5e620..40d4e798e7fb 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -265,3 +265,45 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
265 | printk("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | 265 | printk("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); |
266 | } | 266 | } |
267 | #endif | 267 | #endif |
268 | |||
269 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
270 | void online_page(struct page *page) | ||
271 | { | ||
272 | ClearPageReserved(page); | ||
273 | init_page_count(page); | ||
274 | __free_page(page); | ||
275 | totalram_pages++; | ||
276 | num_physpages++; | ||
277 | } | ||
278 | |||
279 | int arch_add_memory(int nid, u64 start, u64 size) | ||
280 | { | ||
281 | pg_data_t *pgdat; | ||
282 | unsigned long start_pfn = start >> PAGE_SHIFT; | ||
283 | unsigned long nr_pages = size >> PAGE_SHIFT; | ||
284 | int ret; | ||
285 | |||
286 | pgdat = NODE_DATA(nid); | ||
287 | |||
288 | /* We only have ZONE_NORMAL, so this is easy.. */ | ||
289 | ret = __add_pages(pgdat->node_zones + ZONE_NORMAL, start_pfn, nr_pages); | ||
290 | if (unlikely(ret)) | ||
291 | printk("%s: Failed, __add_pages() == %d\n", __FUNCTION__, ret); | ||
292 | |||
293 | return ret; | ||
294 | } | ||
295 | EXPORT_SYMBOL_GPL(arch_add_memory); | ||
296 | |||
297 | int remove_memory(u64 start, u64 size) | ||
298 | { | ||
299 | return -EINVAL; | ||
300 | } | ||
301 | EXPORT_SYMBOL_GPL(remove_memory); | ||
302 | |||
303 | int memory_add_physaddr_to_nid(u64 addr) | ||
304 | { | ||
305 | /* Node 0 for now.. */ | ||
306 | return 0; | ||
307 | } | ||
308 | EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); | ||
309 | #endif | ||
diff --git a/mm/Kconfig b/mm/Kconfig index 8ac412b45f18..62e5d0d0bd5a 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -117,7 +117,7 @@ config MEMORY_HOTPLUG | |||
117 | bool "Allow for memory hot-add" | 117 | bool "Allow for memory hot-add" |
118 | depends on SPARSEMEM || X86_64_ACPI_NUMA | 118 | depends on SPARSEMEM || X86_64_ACPI_NUMA |
119 | depends on HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG | 119 | depends on HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG |
120 | depends on (IA64 || X86 || PPC64) | 120 | depends on (IA64 || X86 || PPC64 || SUPERH) |
121 | 121 | ||
122 | comment "Memory hotplug is currently incompatible with Software Suspend" | 122 | comment "Memory hotplug is currently incompatible with Software Suspend" |
123 | depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND | 123 | depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND |