Re: [RFC PATCH] rework memory hotplug onlining

From: Kani, Toshimitsu
Date: Wed Mar 15 2017 - 19:09:31 EST


On Wed, 2017-03-15 at 10:13 +0100, Michal Hocko wrote:
:
> @@ -388,39 +389,44 @@ static ssize_t show_valid_zones(struct device
> *dev,
> Â struct device_attribute *attr, char
> *buf)
> Â{
> Â struct memory_block *mem = to_memory_block(dev);
> - unsigned long start_pfn, end_pfn;
> - unsigned long valid_start, valid_end, valid_pages;
> - unsigned long nr_pages = PAGES_PER_SECTION *
> sections_per_block;
> + unsigned long start_pfn, nr_pages;
> + bool append = false;
> Â struct zone *zone;
> - int zone_shift = 0;
> + int nid;
> Â
> Â start_pfn = section_nr_to_pfn(mem->start_section_nr);
> - end_pfn = start_pfn + nr_pages;
> + zone = page_zone(pfn_to_page(start_pfn));
> + nr_pages = PAGES_PER_SECTION * sections_per_block;
> Â
> - /* The block contains more than one zone can not be
> offlined. */
> - if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start,
> &valid_end))
> + /*
> + Â* The block contains more than one zone can not be
> offlined.
> + Â* This can happen e.g. for ZONE_DMA and ZONE_DMA32
> + Â*/
> + if (!test_pages_in_a_zone(start_pfn, start_pfn + nr_pages,
> NULL, NULL))
> Â return sprintf(buf, "none\n");
> Â
> - zone = page_zone(pfn_to_page(valid_start));

Please do not remove the fix made in a96dfddbcc043. zone needs to be
set from valid_start, not from start_pfn.

Thanks,
-Toshi