diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/memory.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index dacb6a8418aa..fa26ffd25fa6 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -389,33 +389,33 @@ static ssize_t show_valid_zones(struct device *dev, | |||
389 | { | 389 | { |
390 | struct memory_block *mem = to_memory_block(dev); | 390 | struct memory_block *mem = to_memory_block(dev); |
391 | unsigned long start_pfn, end_pfn; | 391 | unsigned long start_pfn, end_pfn; |
392 | unsigned long valid_start, valid_end, valid_pages; | ||
392 | unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; | 393 | unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; |
393 | struct page *first_page; | ||
394 | struct zone *zone; | 394 | struct zone *zone; |
395 | int zone_shift = 0; | 395 | int zone_shift = 0; |
396 | 396 | ||
397 | start_pfn = section_nr_to_pfn(mem->start_section_nr); | 397 | start_pfn = section_nr_to_pfn(mem->start_section_nr); |
398 | end_pfn = start_pfn + nr_pages; | 398 | end_pfn = start_pfn + nr_pages; |
399 | first_page = pfn_to_page(start_pfn); | ||
400 | 399 | ||
401 | /* The block contains more than one zone can not be offlined. */ | 400 | /* The block contains more than one zone can not be offlined. */ |
402 | if (!test_pages_in_a_zone(start_pfn, end_pfn)) | 401 | if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end)) |
403 | return sprintf(buf, "none\n"); | 402 | return sprintf(buf, "none\n"); |
404 | 403 | ||
405 | zone = page_zone(first_page); | 404 | zone = page_zone(pfn_to_page(valid_start)); |
405 | valid_pages = valid_end - valid_start; | ||
406 | 406 | ||
407 | /* MMOP_ONLINE_KEEP */ | 407 | /* MMOP_ONLINE_KEEP */ |
408 | sprintf(buf, "%s", zone->name); | 408 | sprintf(buf, "%s", zone->name); |
409 | 409 | ||
410 | /* MMOP_ONLINE_KERNEL */ | 410 | /* MMOP_ONLINE_KERNEL */ |
411 | zone_can_shift(start_pfn, nr_pages, ZONE_NORMAL, &zone_shift); | 411 | zone_can_shift(valid_start, valid_pages, ZONE_NORMAL, &zone_shift); |
412 | if (zone_shift) { | 412 | if (zone_shift) { |
413 | strcat(buf, " "); | 413 | strcat(buf, " "); |
414 | strcat(buf, (zone + zone_shift)->name); | 414 | strcat(buf, (zone + zone_shift)->name); |
415 | } | 415 | } |
416 | 416 | ||
417 | /* MMOP_ONLINE_MOVABLE */ | 417 | /* MMOP_ONLINE_MOVABLE */ |
418 | zone_can_shift(start_pfn, nr_pages, ZONE_MOVABLE, &zone_shift); | 418 | zone_can_shift(valid_start, valid_pages, ZONE_MOVABLE, &zone_shift); |
419 | if (zone_shift) { | 419 | if (zone_shift) { |
420 | strcat(buf, " "); | 420 | strcat(buf, " "); |
421 | strcat(buf, (zone + zone_shift)->name); | 421 | strcat(buf, (zone + zone_shift)->name); |