From: Hugh Dickins <hugh@veritas.com>

2.6.5-rc3-mjb1 kswapd died with divide by zero in refill_inactive_zone,
I think it must have been shortly before swapoff completed, so totalswap
was low, then	swap_centile = i.freeswap / 
			(min(i.totalswap, i.totalram) / 100);
is liable to divide by zero.  Or would
		swap_centile = (i.freeswap * 100) /
			min(i.totalswap, i.totalram);
be better?  Perhaps not: I think that won't overflow (with MAX_SWAPFILES
32 plus 1 bit free for !pte_present plus 1 bit free for !pte_file), but
that feels too fragile.






diff -upN reference/mm/vmscan.c current/mm/vmscan.c
--- reference/mm/vmscan.c	2004-05-01 18:09:16.000000000 -0700
+++ current/mm/vmscan.c	2004-05-01 18:09:16.000000000 -0700
@@ -629,7 +629,7 @@ refill_inactive_zone(struct zone *zone, 
 	mapped_ratio = (ps->nr_mapped * 100) / total_memory;
 
 	si_swapinfo(&i);
-	if (likely(i.totalswap)) {
+	if (likely(i.totalswap >= 100)) {
 		int app_centile, swap_centile;
 
 		/*