Re: swappiness=0 makes software suspend fail.

From: Andrew Morton
Date: Mon May 31 2004 - 05:11:58 EST


Pavel Machek <pavel@xxxxxxx> wrote:
>
> Right solution is to make sure that shrink_all_memory() works, no
> matter how swappiness is set.

off-by-one in balance_pgdat() was the main problem.


--- 25/mm/vmscan.c~shrink_all_memory-fix 2004-05-31 03:04:05.669374824 -0700
+++ 25-akpm/mm/vmscan.c 2004-05-31 03:04:05.673374216 -0700
@@ -813,8 +813,7 @@ shrink_caches(struct zone **zones, int p
struct zone *zone = zones[i];
int max_scan;

- if (zone->free_pages < zone->pages_high)
- zone->temp_priority = priority;
+ zone->temp_priority = priority;

if (zone->all_unreclaimable && priority != DEF_PRIORITY)
continue; /* Let kswapd poll it */
@@ -945,7 +944,7 @@ static int balance_pgdat(pg_data_t *pgda
zone->temp_priority = DEF_PRIORITY;
}

- for (priority = DEF_PRIORITY; priority; priority--) {
+ for (priority = DEF_PRIORITY; priority >= 0; priority--) {
int all_zones_ok = 1;
int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */

@@ -995,6 +994,8 @@ scan:
all_zones_ok = 0;
}
zone->temp_priority = priority;
+ if (zone->prev_priority > priority)
+ zone->prev_priority = priority;
max_scan = (zone->nr_active + zone->nr_inactive)
>> priority;
reclaimed = shrink_zone(zone, max_scan, GFP_KERNEL,
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/