
From: Nick Piggin <nickpiggin@yahoo.com.au>

If for some reason a zone's active list is empty but it has inactive pages
and scanning never activates them, we never increment zone->pages_scanned. 
This causes us to never mark the zone as being in an "all pages
unreclaimable" state and we use heaps of kswapd CPU.

We only count pages which were scanned on the active list, in
refill_inactive_zone, which in this case is always zero.

Change the logic so that we also account for inactive list scannings.

This patch will have a side-effect of causing zones to enter the "all
unreclaimable" state earlier.  We may need to tweak the math to compensate for
that.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/mm/vmscan.c |    1 +
 1 files changed, 1 insertion(+)

diff -puN mm/vmscan.c~kswapd-throttling-fix mm/vmscan.c
--- 25/mm/vmscan.c~kswapd-throttling-fix	2005-02-04 02:42:00.865443920 -0800
+++ 25-akpm/mm/vmscan.c	2005-02-04 02:42:42.946046696 -0800
@@ -575,6 +575,7 @@ static void shrink_cache(struct zone *zo
 			nr_taken++;
 		}
 		zone->nr_inactive -= nr_taken;
+		zone->pages_scanned += nr_scan;
 		spin_unlock_irq(&zone->lru_lock);
 
 		if (nr_taken == 0)
_
