diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-18 17:00:57 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-18 17:00:57 -0400 |
| commit | de0ed36a3ecc0b51da4f16fa0af47ba6b7ffad22 (patch) | |
| tree | 77d513dcf8f21a35b20fff4dfaf9d5b32d6369f9 /drivers/base/memory.c | |
| parent | 5fa224295f0e0358c8bc0e5390702338df889def (diff) | |
Revert "memory hotplug: Correct page reservation checking"
This reverts commit 54f23eb7ba7619de85d8edca6e5336bc33072dbd.
Turns out this patch is wrong, another correct one will follow it.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/memory.c')
| -rw-r--r-- | drivers/base/memory.c | 60 |
1 files changed, 23 insertions, 37 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index ca8bfe59ae32..2a0b5f1020ed 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
| @@ -227,42 +227,41 @@ int memory_isolate_notify(unsigned long val, void *v) | |||
| 227 | * MEMORY_HOTPLUG depends on SPARSEMEM in mm/Kconfig, so it is | 227 | * MEMORY_HOTPLUG depends on SPARSEMEM in mm/Kconfig, so it is |
| 228 | * OK to have direct references to sparsemem variables in here. | 228 | * OK to have direct references to sparsemem variables in here. |
| 229 | */ | 229 | */ |
| 230 | static int check_page_reservations(unsigned long phys_index) | ||
| 231 | { | ||
| 232 | int i; | ||
| 233 | struct page *page; | ||
| 234 | |||
| 235 | page = pfn_to_page(phys_index << PFN_SECTION_SHIFT); | ||
| 236 | |||
| 237 | for (i = 0; i < PAGES_PER_SECTION; i++) { | ||
| 238 | if (PageReserved(page + i)) | ||
| 239 | continue; | ||
| 240 | |||
| 241 | printk(KERN_WARNING "section number %ld page number %d " | ||
| 242 | "not reserved, was it already online?\n", phys_index, i); | ||
| 243 | return -EBUSY; | ||
| 244 | } | ||
| 245 | |||
| 246 | return 0; | ||
| 247 | } | ||
| 248 | |||
| 249 | static int | 230 | static int |
| 250 | memory_block_action(unsigned long phys_index, unsigned long action) | 231 | memory_block_action(unsigned long phys_index, unsigned long action) |
| 251 | { | 232 | { |
| 233 | int i; | ||
| 252 | unsigned long start_pfn, start_paddr; | 234 | unsigned long start_pfn, start_paddr; |
| 253 | unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; | 235 | unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; |
| 254 | struct page *page; | 236 | struct page *first_page; |
| 255 | int ret; | 237 | int ret; |
| 256 | 238 | ||
| 257 | page = pfn_to_page(phys_index << PFN_SECTION_SHIFT); | 239 | first_page = pfn_to_page(phys_index << PFN_SECTION_SHIFT); |
| 240 | |||
| 241 | /* | ||
| 242 | * The probe routines leave the pages reserved, just | ||
| 243 | * as the bootmem code does. Make sure they're still | ||
| 244 | * that way. | ||
| 245 | */ | ||
| 246 | if (action == MEM_ONLINE) { | ||
| 247 | for (i = 0; i < nr_pages; i++) { | ||
| 248 | if (PageReserved(first_page+i)) | ||
| 249 | continue; | ||
| 250 | |||
| 251 | printk(KERN_WARNING "section number %ld page number %d " | ||
| 252 | "not reserved, was it already online?\n", | ||
| 253 | phys_index, i); | ||
| 254 | return -EBUSY; | ||
| 255 | } | ||
| 256 | } | ||
| 258 | 257 | ||
| 259 | switch (action) { | 258 | switch (action) { |
| 260 | case MEM_ONLINE: | 259 | case MEM_ONLINE: |
| 261 | start_pfn = page_to_pfn(page); | 260 | start_pfn = page_to_pfn(first_page); |
| 262 | ret = online_pages(start_pfn, nr_pages); | 261 | ret = online_pages(start_pfn, nr_pages); |
| 263 | break; | 262 | break; |
| 264 | case MEM_OFFLINE: | 263 | case MEM_OFFLINE: |
| 265 | start_paddr = page_to_pfn(page) << PAGE_SHIFT; | 264 | start_paddr = page_to_pfn(first_page) << PAGE_SHIFT; |
| 266 | ret = remove_memory(start_paddr, | 265 | ret = remove_memory(start_paddr, |
| 267 | nr_pages << PAGE_SHIFT); | 266 | nr_pages << PAGE_SHIFT); |
| 268 | break; | 267 | break; |
| @@ -278,7 +277,7 @@ memory_block_action(unsigned long phys_index, unsigned long action) | |||
| 278 | static int memory_block_change_state(struct memory_block *mem, | 277 | static int memory_block_change_state(struct memory_block *mem, |
| 279 | unsigned long to_state, unsigned long from_state_req) | 278 | unsigned long to_state, unsigned long from_state_req) |
| 280 | { | 279 | { |
| 281 | int i, ret = 0; | 280 | int ret = 0; |
| 282 | 281 | ||
| 283 | mutex_lock(&mem->state_mutex); | 282 | mutex_lock(&mem->state_mutex); |
| 284 | 283 | ||
| @@ -290,19 +289,6 @@ static int memory_block_change_state(struct memory_block *mem, | |||
| 290 | if (to_state == MEM_OFFLINE) | 289 | if (to_state == MEM_OFFLINE) |
| 291 | mem->state = MEM_GOING_OFFLINE; | 290 | mem->state = MEM_GOING_OFFLINE; |
| 292 | 291 | ||
| 293 | if (to_state == MEM_ONLINE) { | ||
| 294 | /* | ||
| 295 | * The probe routines leave the pages reserved, just | ||
| 296 | * as the bootmem code does. Make sure they're still | ||
| 297 | * that way. | ||
| 298 | */ | ||
| 299 | for (i = 0; i < sections_per_block; i++) { | ||
| 300 | ret = check_page_reservations(mem->start_section_nr + i); | ||
| 301 | if (ret) | ||
| 302 | return ret; | ||
| 303 | } | ||
| 304 | } | ||
| 305 | |||
| 306 | ret = memory_block_action(mem->start_section_nr, to_state); | 292 | ret = memory_block_action(mem->start_section_nr, to_state); |
| 307 | 293 | ||
| 308 | if (ret) | 294 | if (ret) |
