diff options
Diffstat (limited to 'drivers/base/memory.c')
-rw-r--r-- | drivers/base/memory.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index c8a1cb0b6136..817320c7c4c1 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -417,25 +417,23 @@ static ssize_t show_valid_zones(struct device *dev, | |||
417 | int nid; | 417 | int nid; |
418 | 418 | ||
419 | /* | 419 | /* |
420 | * The block contains more than one zone can not be offlined. | ||
421 | * This can happen e.g. for ZONE_DMA and ZONE_DMA32 | ||
422 | */ | ||
423 | if (!test_pages_in_a_zone(start_pfn, start_pfn + nr_pages, &valid_start_pfn, &valid_end_pfn)) | ||
424 | return sprintf(buf, "none\n"); | ||
425 | |||
426 | start_pfn = valid_start_pfn; | ||
427 | nr_pages = valid_end_pfn - start_pfn; | ||
428 | |||
429 | /* | ||
430 | * Check the existing zone. Make sure that we do that only on the | 420 | * Check the existing zone. Make sure that we do that only on the |
431 | * online nodes otherwise the page_zone is not reliable | 421 | * online nodes otherwise the page_zone is not reliable |
432 | */ | 422 | */ |
433 | if (mem->state == MEM_ONLINE) { | 423 | if (mem->state == MEM_ONLINE) { |
424 | /* | ||
425 | * The block contains more than one zone can not be offlined. | ||
426 | * This can happen e.g. for ZONE_DMA and ZONE_DMA32 | ||
427 | */ | ||
428 | if (!test_pages_in_a_zone(start_pfn, start_pfn + nr_pages, | ||
429 | &valid_start_pfn, &valid_end_pfn)) | ||
430 | return sprintf(buf, "none\n"); | ||
431 | start_pfn = valid_start_pfn; | ||
434 | strcat(buf, page_zone(pfn_to_page(start_pfn))->name); | 432 | strcat(buf, page_zone(pfn_to_page(start_pfn))->name); |
435 | goto out; | 433 | goto out; |
436 | } | 434 | } |
437 | 435 | ||
438 | nid = pfn_to_nid(start_pfn); | 436 | nid = mem->nid; |
439 | default_zone = zone_for_pfn_range(MMOP_ONLINE_KEEP, nid, start_pfn, nr_pages); | 437 | default_zone = zone_for_pfn_range(MMOP_ONLINE_KEEP, nid, start_pfn, nr_pages); |
440 | strcat(buf, default_zone->name); | 438 | strcat(buf, default_zone->name); |
441 | 439 | ||