From: Nick Piggin Testing has shown this to be much of a muchness, but this is a bit more in line with how the direct reclaim path works. Signed-off-by: Andrew Morton --- 25-akpm/mm/vmscan.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff -puN mm/vmscan.c~vm-no-wild-kswapd-fix mm/vmscan.c --- 25/mm/vmscan.c~vm-no-wild-kswapd-fix Thu Sep 30 16:08:10 2004 +++ 25-akpm/mm/vmscan.c Thu Sep 30 16:08:10 2004 @@ -989,6 +989,7 @@ out: static int balance_pgdat(pg_data_t *pgdat, int nr_pages) { int to_free = nr_pages; + int all_zones_ok; int priority; int i; int total_scanned, total_reclaimed; @@ -1011,10 +1012,11 @@ loop_again: } for (priority = DEF_PRIORITY; priority >= 0; priority--) { - int all_zones_ok = 1; int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ unsigned long lru_pages = 0; + all_zones_ok = 1; + if (nr_pages == 0) { /* * Scan in the highmem->dma direction for the highest @@ -1104,7 +1106,7 @@ scan: * on zone->*_priority. */ if (total_reclaimed >= SWAP_CLUSTER_MAX) - goto loop_again; + break; } out: for (i = 0; i < pgdat->nr_zones; i++) { @@ -1112,6 +1114,9 @@ out: zone->prev_priority = zone->temp_priority; } + if (!all_zones_ok) + goto loop_again; + return total_reclaimed; } _