Skip to content

Commit 8080fc0

Browse files
Xishi Qiutorvalds
authored andcommitted
mm: use zone_is_empty() instead of if(zone->spanned_pages)
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>
1 parent c33bc31 commit 8080fc0

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎mm/memory_hotplug.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static void grow_zone_span(struct zone *zone, unsigned long start_pfn,
230230
zone_span_writelock(zone);
231231

232232
old_zone_end_pfn = zone_end_pfn(zone);
233-
if (!zone->spanned_pages || start_pfn < zone->zone_start_pfn)
233+
if (zone_is_empty(zone) || start_pfn < zone->zone_start_pfn)
234234
zone->zone_start_pfn = start_pfn;
235235

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

307307
/* use start_pfn for z1's start_pfn if z1 is empty */
308-
if (z1->spanned_pages)
308+
if (!zone_is_empty(z1))
309309
z1_start_pfn = z1->zone_start_pfn;
310310
else
311311
z1_start_pfn = start_pfn;
@@ -347,7 +347,7 @@ static int __meminit move_pfn_range_right(struct zone *z1, struct zone *z2,
347347
goto out_fail;
348348

349349
/* use end_pfn for z2's end_pfn if z2 is empty */
350-
if (z2->spanned_pages)
350+
if (!zone_is_empty(z2))
351351
z2_end_pfn = zone_end_pfn(z2);
352352
else
353353
z2_end_pfn = end_pfn;

‎mm/page_alloc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ void mark_free_pages(struct zone *zone)
13061306
int order, t;
13071307
struct list_head *curr;
13081308

1309-
if (!zone->spanned_pages)
1309+
if (zone_is_empty(zone))
13101310
return;
13111311

13121312
spin_lock_irqsave(&zone->lock, flags);

0 commit comments

Comments
 (0)