aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/mmzone.h5
-rw-r--r--mm/page_alloc.c8
-rw-r--r--mm/vmscan.c8
3 files changed, 13 insertions, 8 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 8d6caa414c4c..c34f4a2c62f8 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -388,6 +388,11 @@ static inline struct zone *next_zone(struct zone *zone)
388#define for_each_zone(zone) \ 388#define for_each_zone(zone) \
389 for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone)) 389 for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone))
390 390
391static inline int populated_zone(struct zone *zone)
392{
393 return (!!zone->present_pages);
394}
395
391static inline int is_highmem_idx(int idx) 396static inline int is_highmem_idx(int idx)
392{ 397{
393 return (idx == ZONE_HIGHMEM); 398 return (idx == ZONE_HIGHMEM);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b9fd2c238f13..8f3de5af92dd 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1358,7 +1358,7 @@ void show_free_areas(void)
1358 show_node(zone); 1358 show_node(zone);
1359 printk("%s per-cpu:", zone->name); 1359 printk("%s per-cpu:", zone->name);
1360 1360
1361 if (!zone->present_pages) { 1361 if (!populated_zone(zone)) {
1362 printk(" empty\n"); 1362 printk(" empty\n");
1363 continue; 1363 continue;
1364 } else 1364 } else
@@ -1435,7 +1435,7 @@ void show_free_areas(void)
1435 1435
1436 show_node(zone); 1436 show_node(zone);
1437 printk("%s: ", zone->name); 1437 printk("%s: ", zone->name);
1438 if (!zone->present_pages) { 1438 if (!populated_zone(zone)) {
1439 printk("empty\n"); 1439 printk("empty\n");
1440 continue; 1440 continue;
1441 } 1441 }
@@ -2134,7 +2134,7 @@ static int frag_show(struct seq_file *m, void *arg)
2134 int order; 2134 int order;
2135 2135
2136 for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) { 2136 for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) {
2137 if (!zone->present_pages) 2137 if (!populated_zone(zone))
2138 continue; 2138 continue;
2139 2139
2140 spin_lock_irqsave(&zone->lock, flags); 2140 spin_lock_irqsave(&zone->lock, flags);
@@ -2167,7 +2167,7 @@ static int zoneinfo_show(struct seq_file *m, void *arg)
2167 for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; zone++) { 2167 for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; zone++) {
2168 int i; 2168 int i;
2169 2169
2170 if (!zone->present_pages) 2170 if (!populated_zone(zone))
2171 continue; 2171 continue;
2172 2172
2173 spin_lock_irqsave(&zone->lock, flags); 2173 spin_lock_irqsave(&zone->lock, flags);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5c8a412b43f4..7681d8ee04fe 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -897,7 +897,7 @@ shrink_caches(struct zone **zones, struct scan_control *sc)
897 for (i = 0; zones[i] != NULL; i++) { 897 for (i = 0; zones[i] != NULL; i++) {
898 struct zone *zone = zones[i]; 898 struct zone *zone = zones[i];
899 899
900 if (zone->present_pages == 0) 900 if (!populated_zone(zone))
901 continue; 901 continue;
902 902
903 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) 903 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
@@ -1069,7 +1069,7 @@ loop_again:
1069 for (i = pgdat->nr_zones - 1; i >= 0; i--) { 1069 for (i = pgdat->nr_zones - 1; i >= 0; i--) {
1070 struct zone *zone = pgdat->node_zones + i; 1070 struct zone *zone = pgdat->node_zones + i;
1071 1071
1072 if (zone->present_pages == 0) 1072 if (!populated_zone(zone))
1073 continue; 1073 continue;
1074 1074
1075 if (zone->all_unreclaimable && 1075 if (zone->all_unreclaimable &&
@@ -1106,7 +1106,7 @@ scan:
1106 struct zone *zone = pgdat->node_zones + i; 1106 struct zone *zone = pgdat->node_zones + i;
1107 int nr_slab; 1107 int nr_slab;
1108 1108
1109 if (zone->present_pages == 0) 1109 if (!populated_zone(zone))
1110 continue; 1110 continue;
1111 1111
1112 if (zone->all_unreclaimable && priority != DEF_PRIORITY) 1112 if (zone->all_unreclaimable && priority != DEF_PRIORITY)
@@ -1258,7 +1258,7 @@ void wakeup_kswapd(struct zone *zone, int order)
1258{ 1258{
1259 pg_data_t *pgdat; 1259 pg_data_t *pgdat;
1260 1260
1261 if (zone->present_pages == 0) 1261 if (!populated_zone(zone))
1262 return; 1262 return;
1263 1263
1264 pgdat = zone->zone_pgdat; 1264 pgdat = zone->zone_pgdat;