提交 a371d9f1 编写于 作者: R Reza Arbab 提交者: Linus Torvalds

memory-hotplug: use zone_can_shift() for sysfs valid_zones attribute

Since zone_can_shift() is being used to validate the target zone during
onlining, it should also be used to determine the content of
valid_zones.

Link: http://lkml.kernel.org/r/1462816419-4479-4-git-send-email-arbab@linux.vnet.ibm.comSigned-off-by: NReza Arbab <arbab@linux.vnet.ibm.com>
Reviewd-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Daniel Kiper <daniel.kiper@oracle.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Andrew Banman <abanman@sgi.com>
Cc: Chen Yucong <slaoub@gmail.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Zhang Zhen <zhenzhang.zhang@huawei.com>
Cc: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 df429ac0
...@@ -391,6 +391,7 @@ static ssize_t show_valid_zones(struct device *dev, ...@@ -391,6 +391,7 @@ static ssize_t show_valid_zones(struct device *dev,
unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
struct page *first_page; struct page *first_page;
struct zone *zone; struct zone *zone;
int zone_shift = 0;
start_pfn = section_nr_to_pfn(mem->start_section_nr); start_pfn = section_nr_to_pfn(mem->start_section_nr);
end_pfn = start_pfn + nr_pages; end_pfn = start_pfn + nr_pages;
...@@ -402,21 +403,26 @@ static ssize_t show_valid_zones(struct device *dev, ...@@ -402,21 +403,26 @@ static ssize_t show_valid_zones(struct device *dev,
zone = page_zone(first_page); zone = page_zone(first_page);
if (zone_idx(zone) == ZONE_MOVABLE - 1) { /* MMOP_ONLINE_KEEP */
/*The mem block is the last memoryblock of this zone.*/ sprintf(buf, "%s", zone->name);
if (end_pfn == zone_end_pfn(zone))
return sprintf(buf, "%s %s\n", /* MMOP_ONLINE_KERNEL */
zone->name, (zone + 1)->name); zone_shift = zone_can_shift(start_pfn, nr_pages, ZONE_NORMAL);
if (zone_shift) {
strcat(buf, " ");
strcat(buf, (zone + zone_shift)->name);
} }
if (zone_idx(zone) == ZONE_MOVABLE) { /* MMOP_ONLINE_MOVABLE */
/*The mem block is the first memoryblock of ZONE_MOVABLE.*/ zone_shift = zone_can_shift(start_pfn, nr_pages, ZONE_MOVABLE);
if (start_pfn == zone->zone_start_pfn) if (zone_shift) {
return sprintf(buf, "%s %s\n", strcat(buf, " ");
zone->name, (zone - 1)->name); strcat(buf, (zone + zone_shift)->name);
} }
return sprintf(buf, "%s\n", zone->name); strcat(buf, "\n");
return strlen(buf);
} }
static DEVICE_ATTR(valid_zones, 0444, show_valid_zones, NULL); static DEVICE_ATTR(valid_zones, 0444, show_valid_zones, NULL);
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册