aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-04-28 05:12:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:17 -0400
commit180c06efce691f2b721dd0d965079827bdd7ee03 (patch)
tree6d5dbde8f341544bbd212e9d376af1e7880a4229 /arch
parentea01ea937dcae2caa146dea1918cccf2f16ed3c4 (diff)
hotplug-memory: make online_page() common
All architectures use an effectively identical definition of online_page(), so just make it common code. x86-64, ia64, powerpc and sh are actually identical; x86-32 is slightly different. x86-32's differences arise because it puts its hotplug pages in the highmem zone. We can handle this in the generic code by inspecting the page to see if its in highmem, and update the totalhigh_pages count appropriately. This leaves init_32.c:free_new_highpage with a single caller, so I folded it into add_one_highpage_init. I also removed an incorrect comment referring to the NUMA case; any NUMA details have already been dealt with by the time online_page() is called. [akpm@linux-foundation.org: fix indenting] Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Acked-by: Dave Hansen <dave@linux.vnet.ibm.com> Reviewed-by: KAMEZAWA Hiroyuki <kamez.hiroyu@jp.fujitsu.com> Tested-by: KAMEZAWA Hiroyuki <kamez.hiroyu@jp.fujitsu.com> Cc: Yasunori Goto <y-goto@jp.fujitsu.com> Cc: Christoph Lameter <clameter@sgi.com> Acked-by: Ingo Molnar <mingo@elte.hu> Acked-by: Yasunori Goto <y-goto@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/mm/init.c9
-rw-r--r--arch/powerpc/mm/mem.c9
-rw-r--r--arch/sh/mm/init.c9
-rw-r--r--arch/x86/mm/init_32.c36
-rw-r--r--arch/x86/mm/init_64.c9
5 files changed, 3 insertions, 69 deletions
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 5c1de53c8c1c..fc6c6636ffda 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -682,15 +682,6 @@ mem_init (void)
682} 682}
683 683
684#ifdef CONFIG_MEMORY_HOTPLUG 684#ifdef CONFIG_MEMORY_HOTPLUG
685void online_page(struct page *page)
686{
687 ClearPageReserved(page);
688 init_page_count(page);
689 __free_page(page);
690 totalram_pages++;
691 num_physpages++;
692}
693
694int arch_add_memory(int nid, u64 start, u64 size) 685int arch_add_memory(int nid, u64 start, u64 size)
695{ 686{
696 pg_data_t *pgdat; 687 pg_data_t *pgdat;
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 5ccb579b81e4..d9e37f365b54 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -110,15 +110,6 @@ EXPORT_SYMBOL(phys_mem_access_prot);
110 110
111#ifdef CONFIG_MEMORY_HOTPLUG 111#ifdef CONFIG_MEMORY_HOTPLUG
112 112
113void online_page(struct page *page)
114{
115 ClearPageReserved(page);
116 init_page_count(page);
117 __free_page(page);
118 totalram_pages++;
119 num_physpages++;
120}
121
122#ifdef CONFIG_NUMA 113#ifdef CONFIG_NUMA
123int memory_add_physaddr_to_nid(u64 start) 114int memory_add_physaddr_to_nid(u64 start)
124{ 115{
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 53dde0607362..d7df26bd1e54 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -307,15 +307,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
307#endif 307#endif
308 308
309#ifdef CONFIG_MEMORY_HOTPLUG 309#ifdef CONFIG_MEMORY_HOTPLUG
310void online_page(struct page *page)
311{
312 ClearPageReserved(page);
313 init_page_count(page);
314 __free_page(page);
315 totalram_pages++;
316 num_physpages++;
317}
318
319int arch_add_memory(int nid, u64 start, u64 size) 310int arch_add_memory(int nid, u64 start, u64 size)
320{ 311{
321 pg_data_t *pgdat; 312 pg_data_t *pgdat;
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 4a4761892951..de236e419cb5 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -287,47 +287,17 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base)
287 pkmap_page_table = pte; 287 pkmap_page_table = pte;
288} 288}
289 289
290static void __meminit free_new_highpage(struct page *page)
291{
292 init_page_count(page);
293 __free_page(page);
294 totalhigh_pages++;
295}
296
297void __init add_one_highpage_init(struct page *page, int pfn, int bad_ppro) 290void __init add_one_highpage_init(struct page *page, int pfn, int bad_ppro)
298{ 291{
299 if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn))) { 292 if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn))) {
300 ClearPageReserved(page); 293 ClearPageReserved(page);
301 free_new_highpage(page); 294 init_page_count(page);
295 __free_page(page);
296 totalhigh_pages++;
302 } else 297 } else
303 SetPageReserved(page); 298 SetPageReserved(page);
304} 299}
305 300
306static int __meminit
307add_one_highpage_hotplug(struct page *page, unsigned long pfn)
308{
309 free_new_highpage(page);
310 totalram_pages++;
311#ifdef CONFIG_FLATMEM
312 max_mapnr = max(pfn, max_mapnr);
313#endif
314 num_physpages++;
315
316 return 0;
317}
318
319/*
320 * Not currently handling the NUMA case.
321 * Assuming single node and all memory that
322 * has been added dynamically that would be
323 * onlined here is in HIGHMEM.
324 */
325void __meminit online_page(struct page *page)
326{
327 ClearPageReserved(page);
328 add_one_highpage_hotplug(page, page_to_pfn(page));
329}
330
331#ifndef CONFIG_NUMA 301#ifndef CONFIG_NUMA
332static void __init set_highmem_pages_init(int bad_ppro) 302static void __init set_highmem_pages_init(int bad_ppro)
333{ 303{
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 5fbb8652cf59..32ba13b0f818 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -620,15 +620,6 @@ void __init paging_init(void)
620/* 620/*
621 * Memory hotplug specific functions 621 * Memory hotplug specific functions
622 */ 622 */
623void online_page(struct page *page)
624{
625 ClearPageReserved(page);
626 init_page_count(page);
627 __free_page(page);
628 totalram_pages++;
629 num_physpages++;
630}
631
632#ifdef CONFIG_MEMORY_HOTPLUG 623#ifdef CONFIG_MEMORY_HOTPLUG
633/* 624/*
634 * Memory is added always to NORMAL zone. This means you will never get 625 * Memory is added always to NORMAL zone. This means you will never get