Re: Can't make use of swap memory in 2.6.7-bk19

From: Nick Piggin
Date: Wed Jul 07 2004 - 21:18:15 EST


Peter Osterlund wrote:
I created a test program that allocates a 300MB buffer and writes to
all bytes sequentially. On my computer, which has 256MB RAM and 512MB
swap, the program gets OOM killed after dirtying about 140-180MB, and
the kernel reports:


Someone hand me a paper bag... Peter, can you give this patch a try?


---

linux-2.6-npiggin/mm/vmscan.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff -puN mm/vmscan.c~vm-allocfail-fix mm/vmscan.c
--- linux-2.6/mm/vmscan.c~vm-allocfail-fix 2004-07-08 12:10:29.000000000 +1000
+++ linux-2.6-npiggin/mm/vmscan.c 2004-07-08 12:12:33.000000000 +1000
@@ -917,12 +917,12 @@ int try_to_free_pages(struct zone **zone
sc.nr_reclaimed += reclaim_state->reclaimed_slab;
reclaim_state->reclaimed_slab = 0;
}
- if (sc.nr_reclaimed >= SWAP_CLUSTER_MAX) {
+ total_scanned += sc.nr_scanned;
+ total_reclaimed += sc.nr_reclaimed;
+ if (total_reclaimed >= SWAP_CLUSTER_MAX) {
ret = 1;
goto out;
}
- total_scanned += sc.nr_scanned;
- total_reclaimed += sc.nr_reclaimed;

/*
* Try to write back as many pages as we just scanned. This

_