Cache eats memory: partially "solved"!?

Hubert Mantel (mantel@suse.de)
Sun, 8 Sep 1996 17:54:15 +0200 (MET DST)


Hello,

today I made some tests and found the reason why in recent kernels there
is some memory missing:

It was the patch to mm/vmscan.c in patch-2.0.5

I assume the following:

With older kernels the system could hang when no more swap was available.
For this reason the change in vmscan.c was made. But now the kernel seems
to give up too early. It returns even if there are cached buffers which
could be freed in order to get some memory.

When I reverse the patch to vmscan.c, I'm able to install on a system with
only 8 MB of memory and no swap. I know this is not the correct solution
for that problem, but it may show the right way to the kernel hackers that
are familiar with that part of the kernel.

Hubert mantel@suse.de

This is the patch which gives me the lost memory:

---- snip -------------------------------------------------------------
diff -urN linux-2.0.18-clean/mm/vmscan.c linux-2.0.18-big/mm/vmscan.c
--- linux-2.0.18-clean/mm/vmscan.c Tue Aug 13 14:00:33 1996
+++ linux-2.0.18-big/mm/vmscan.c Sun Sep 8 17:04:42 1996
@@ -109,7 +109,7 @@
if (page_map->count != 1)
return 0;
if (!(entry = get_swap_page()))
- return -1; /* Aieee!!! Out of swap space! */
+ return 0;
vma->vm_mm->rss--;
flush_cache_page(vma, address);
set_pte(page_table, __pte(entry));
@@ -312,8 +312,6 @@
if (!--p->swap_cnt)
swap_task++;
switch (swap_out_process(p, dma, wait)) {
- case -1:
- return 0;
case 0:
if (p->swap_cnt)
swap_task++;
---- snip -------------------------------------------------------------