Skip to content

Commit

Permalink
mm: use zone_is_empty() instead of if(zone->spanned_pages)
Browse files Browse the repository at this point in the history
Use "zone_is_empty()" instead of "if (zone->spanned_pages)".
Simplify the code, no functional change.

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
Cc: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Xishi Qiu authored and Linus Torvalds committed Sep 11, 2013
1 parent c33bc31 commit 8080fc0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ static void grow_zone_span(struct zone *zone, unsigned long start_pfn,
zone_span_writelock(zone);

old_zone_end_pfn = zone_end_pfn(zone);
if (!zone->spanned_pages || start_pfn < zone->zone_start_pfn)
if (zone_is_empty(zone) || start_pfn < zone->zone_start_pfn)
zone->zone_start_pfn = start_pfn;

zone->spanned_pages = max(old_zone_end_pfn, end_pfn) -
Expand Down Expand Up @@ -305,7 +305,7 @@ static int __meminit move_pfn_range_left(struct zone *z1, struct zone *z2,
goto out_fail;

/* use start_pfn for z1's start_pfn if z1 is empty */
if (z1->spanned_pages)
if (!zone_is_empty(z1))
z1_start_pfn = z1->zone_start_pfn;
else
z1_start_pfn = start_pfn;
Expand Down Expand Up @@ -347,7 +347,7 @@ static int __meminit move_pfn_range_right(struct zone *z1, struct zone *z2,
goto out_fail;

/* use end_pfn for z2's end_pfn if z2 is empty */
if (z2->spanned_pages)
if (!zone_is_empty(z2))
z2_end_pfn = zone_end_pfn(z2);
else
z2_end_pfn = end_pfn;
Expand Down
2 changes: 1 addition & 1 deletion mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ void mark_free_pages(struct zone *zone)
int order, t;
struct list_head *curr;

if (!zone->spanned_pages)
if (zone_is_empty(zone))
return;

spin_lock_irqsave(&zone->lock, flags);
Expand Down

0 comments on commit 8080fc0

Please sign in to comment.