Commit d3e54058 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] vmscan: handle empty zones

There's a lockup condition where kswapd ensounters an empty zone which has all
its metadata set to zero.

Fix that by adding explicit checks for empty zones and just skip over them.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 70d88abf
......@@ -851,6 +851,9 @@ shrink_caches(struct zone **zones, struct scan_control *sc)
for (i = 0; zones[i] != NULL; i++) {
struct zone *zone = zones[i];
if (zone->present_pages == 0)
continue;
zone->temp_priority = sc->priority;
if (zone->prev_priority > sc->priority)
zone->prev_priority = sc->priority;
......@@ -1004,6 +1007,9 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages)
for (i = pgdat->nr_zones - 1; i >= 0; i--) {
struct zone *zone = pgdat->node_zones + i;
if (zone->present_pages == 0)
continue;
if (zone->all_unreclaimable &&
priority != DEF_PRIORITY)
continue;
......@@ -1036,6 +1042,9 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages)
for (i = 0; i <= end_zone; i++) {
struct zone *zone = pgdat->node_zones + i;
if (zone->present_pages == 0)
continue;
if (zone->all_unreclaimable && priority != DEF_PRIORITY)
continue;
......@@ -1159,6 +1168,8 @@ static int kswapd(void *p)
*/
void wakeup_kswapd(struct zone *zone)
{
if (zone->present_pages == 0)
return;
if (zone->free_pages > zone->pages_low)
return;
if (!waitqueue_active(&zone->zone_pgdat->kswapd_wait))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment