diff options
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r-- | mm/memory_hotplug.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index a2832c092509..e92f04749fcb 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -82,9 +82,10 @@ static void release_memory_resource(struct resource *res) | |||
82 | 82 | ||
83 | #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE | 83 | #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE |
84 | #ifndef CONFIG_SPARSEMEM_VMEMMAP | 84 | #ifndef CONFIG_SPARSEMEM_VMEMMAP |
85 | static void get_page_bootmem(unsigned long info, struct page *page, int type) | 85 | static void get_page_bootmem(unsigned long info, struct page *page, |
86 | unsigned long type) | ||
86 | { | 87 | { |
87 | atomic_set(&page->_mapcount, type); | 88 | page->lru.next = (struct list_head *) type; |
88 | SetPagePrivate(page); | 89 | SetPagePrivate(page); |
89 | set_page_private(page, info); | 90 | set_page_private(page, info); |
90 | atomic_inc(&page->_count); | 91 | atomic_inc(&page->_count); |
@@ -94,15 +95,16 @@ static void get_page_bootmem(unsigned long info, struct page *page, int type) | |||
94 | * so use __ref to tell modpost not to generate a warning */ | 95 | * so use __ref to tell modpost not to generate a warning */ |
95 | void __ref put_page_bootmem(struct page *page) | 96 | void __ref put_page_bootmem(struct page *page) |
96 | { | 97 | { |
97 | int type; | 98 | unsigned long type; |
98 | 99 | ||
99 | type = atomic_read(&page->_mapcount); | 100 | type = (unsigned long) page->lru.next; |
100 | BUG_ON(type >= -1); | 101 | BUG_ON(type < MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE || |
102 | type > MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE); | ||
101 | 103 | ||
102 | if (atomic_dec_return(&page->_count) == 1) { | 104 | if (atomic_dec_return(&page->_count) == 1) { |
103 | ClearPagePrivate(page); | 105 | ClearPagePrivate(page); |
104 | set_page_private(page, 0); | 106 | set_page_private(page, 0); |
105 | reset_page_mapcount(page); | 107 | INIT_LIST_HEAD(&page->lru); |
106 | __free_pages_bootmem(page, 0); | 108 | __free_pages_bootmem(page, 0); |
107 | } | 109 | } |
108 | 110 | ||