提交 5d12071c 编写于 作者: D David Hildenbrand 提交者: Linus Torvalds

mm/memory_hotplug: drop local variables in shrink_zone_span()

Get rid of the unnecessary local variables.

Link: http://lkml.kernel.org/r/20191006085646.5768-10-david@redhat.comSigned-off-by: NDavid Hildenbrand <david@redhat.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Pankaj Gupta <pagupta@redhat.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 950b68d9
...@@ -392,14 +392,11 @@ static unsigned long find_biggest_section_pfn(int nid, struct zone *zone, ...@@ -392,14 +392,11 @@ static unsigned long find_biggest_section_pfn(int nid, struct zone *zone,
static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
unsigned long end_pfn) unsigned long end_pfn)
{ {
unsigned long zone_start_pfn = zone->zone_start_pfn;
unsigned long z = zone_end_pfn(zone); /* zone_end_pfn namespace clash */
unsigned long zone_end_pfn = z;
unsigned long pfn; unsigned long pfn;
int nid = zone_to_nid(zone); int nid = zone_to_nid(zone);
zone_span_writelock(zone); zone_span_writelock(zone);
if (zone_start_pfn == start_pfn) { if (zone->zone_start_pfn == start_pfn) {
/* /*
* If the section is smallest section in the zone, it need * If the section is smallest section in the zone, it need
* shrink zone->zone_start_pfn and zone->zone_spanned_pages. * shrink zone->zone_start_pfn and zone->zone_spanned_pages.
...@@ -407,25 +404,25 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, ...@@ -407,25 +404,25 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
* for shrinking zone. * for shrinking zone.
*/ */
pfn = find_smallest_section_pfn(nid, zone, end_pfn, pfn = find_smallest_section_pfn(nid, zone, end_pfn,
zone_end_pfn); zone_end_pfn(zone));
if (pfn) { if (pfn) {
zone->spanned_pages = zone_end_pfn(zone) - pfn;
zone->zone_start_pfn = pfn; zone->zone_start_pfn = pfn;
zone->spanned_pages = zone_end_pfn - pfn;
} else { } else {
zone->zone_start_pfn = 0; zone->zone_start_pfn = 0;
zone->spanned_pages = 0; zone->spanned_pages = 0;
} }
} else if (zone_end_pfn == end_pfn) { } else if (zone_end_pfn(zone) == end_pfn) {
/* /*
* If the section is biggest section in the zone, it need * If the section is biggest section in the zone, it need
* shrink zone->spanned_pages. * shrink zone->spanned_pages.
* In this case, we find second biggest valid mem_section for * In this case, we find second biggest valid mem_section for
* shrinking zone. * shrinking zone.
*/ */
pfn = find_biggest_section_pfn(nid, zone, zone_start_pfn, pfn = find_biggest_section_pfn(nid, zone, zone->zone_start_pfn,
start_pfn); start_pfn);
if (pfn) if (pfn)
zone->spanned_pages = pfn - zone_start_pfn + 1; zone->spanned_pages = pfn - zone->zone_start_pfn + 1;
else { else {
zone->zone_start_pfn = 0; zone->zone_start_pfn = 0;
zone->spanned_pages = 0; zone->spanned_pages = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册