diff options
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r-- | mm/memory_hotplug.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 2047465cd27c..be211a582930 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <linux/page-isolation.h> | 27 | #include <linux/page-isolation.h> |
28 | #include <linux/pfn.h> | 28 | #include <linux/pfn.h> |
29 | #include <linux/suspend.h> | 29 | #include <linux/suspend.h> |
30 | #include <linux/mm_inline.h> | ||
31 | #include <linux/firmware-map.h> | ||
30 | 32 | ||
31 | #include <asm/tlbflush.h> | 33 | #include <asm/tlbflush.h> |
32 | 34 | ||
@@ -71,7 +73,9 @@ static void get_page_bootmem(unsigned long info, struct page *page, int type) | |||
71 | atomic_inc(&page->_count); | 73 | atomic_inc(&page->_count); |
72 | } | 74 | } |
73 | 75 | ||
74 | void put_page_bootmem(struct page *page) | 76 | /* reference to __meminit __free_pages_bootmem is valid |
77 | * so use __ref to tell modpost not to generate a warning */ | ||
78 | void __ref put_page_bootmem(struct page *page) | ||
75 | { | 79 | { |
76 | int type; | 80 | int type; |
77 | 81 | ||
@@ -520,6 +524,9 @@ int __ref add_memory(int nid, u64 start, u64 size) | |||
520 | BUG_ON(ret); | 524 | BUG_ON(ret); |
521 | } | 525 | } |
522 | 526 | ||
527 | /* create new memmap entry */ | ||
528 | firmware_map_add_hotplug(start, start + size, "System RAM"); | ||
529 | |||
523 | goto out; | 530 | goto out; |
524 | 531 | ||
525 | error: | 532 | error: |
@@ -672,15 +679,18 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) | |||
672 | if (!ret) { /* Success */ | 679 | if (!ret) { /* Success */ |
673 | list_add_tail(&page->lru, &source); | 680 | list_add_tail(&page->lru, &source); |
674 | move_pages--; | 681 | move_pages--; |
682 | inc_zone_page_state(page, NR_ISOLATED_ANON + | ||
683 | page_is_file_cache(page)); | ||
684 | |||
675 | } else { | 685 | } else { |
676 | /* Becasue we don't have big zone->lock. we should | 686 | /* Becasue we don't have big zone->lock. we should |
677 | check this again here. */ | 687 | check this again here. */ |
678 | if (page_count(page)) | 688 | if (page_count(page)) |
679 | not_managed++; | 689 | not_managed++; |
680 | #ifdef CONFIG_DEBUG_VM | 690 | #ifdef CONFIG_DEBUG_VM |
681 | printk(KERN_INFO "removing from LRU failed" | 691 | printk(KERN_ALERT "removing pfn %lx from LRU failed\n", |
682 | " %lx/%d/%lx\n", | 692 | pfn); |
683 | pfn, page_count(page), page->flags); | 693 | dump_page(page); |
684 | #endif | 694 | #endif |
685 | } | 695 | } |
686 | } | 696 | } |
@@ -694,7 +704,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) | |||
694 | if (list_empty(&source)) | 704 | if (list_empty(&source)) |
695 | goto out; | 705 | goto out; |
696 | /* this function returns # of failed pages */ | 706 | /* this function returns # of failed pages */ |
697 | ret = migrate_pages(&source, hotremove_migrate_alloc, 0); | 707 | ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1); |
698 | 708 | ||
699 | out: | 709 | out: |
700 | return ret; | 710 | return ret; |
@@ -747,7 +757,7 @@ check_pages_isolated(unsigned long start_pfn, unsigned long end_pfn) | |||
747 | return offlined; | 757 | return offlined; |
748 | } | 758 | } |
749 | 759 | ||
750 | int offline_pages(unsigned long start_pfn, | 760 | static int offline_pages(unsigned long start_pfn, |
751 | unsigned long end_pfn, unsigned long timeout) | 761 | unsigned long end_pfn, unsigned long timeout) |
752 | { | 762 | { |
753 | unsigned long pfn, nr_pages, expire; | 763 | unsigned long pfn, nr_pages, expire; |
@@ -849,6 +859,10 @@ repeat: | |||
849 | 859 | ||
850 | setup_per_zone_wmarks(); | 860 | setup_per_zone_wmarks(); |
851 | calculate_zone_inactive_ratio(zone); | 861 | calculate_zone_inactive_ratio(zone); |
862 | if (!node_present_pages(node)) { | ||
863 | node_clear_state(node, N_HIGH_MEMORY); | ||
864 | kswapd_stop(node); | ||
865 | } | ||
852 | 866 | ||
853 | vm_total_pages = nr_free_pagecache_pages(); | 867 | vm_total_pages = nr_free_pagecache_pages(); |
854 | writeback_set_ratelimit(); | 868 | writeback_set_ratelimit(); |