2003-02-14 23:47:14

by Siim Vahtre

[permalink] [raw]
Subject: swap never cleaned up

Hi.

Since moving from 2.5.59 to 2.5.60 I've noticed some strange
behaviour with swap managment. For some unknown reason the
swapspace starts to fill up but it will NEVER get freed.
Hence, it is first time in my life when I actually see swap
used more than 20M on this computer!

Anyway, after some time I am in situation where swap is 100% used
and I can't do anything (fork: Cannot allocate memory) although
I have practically no programs running at all.

Making more swapspace is useless, because new swap will eventually
be bloated aswell. The only solution I found was to use "swapoff",
which makes some heavy i/o and sometimes kills few random processes
(bash, screen) but frees the swap. After using "swapon", it starts to
be filled up again. Using "swapoff" also mysteriously frees about 50M
of RAM from nowhere. Otherwise the memory managment seems to be OK.

Swap that I use (according to "file") is "Linux/i386 swap file
(new style) 1 (4K pages) size 15623 pages (64M)". Note that it
doesn't matter if the swap is in /dev/hda2 or in /swapfile, either
way it is never cleaned up.

I don't know if it matters but I've got 128M of RAM (which is more
than enough for me) and have tmpfs mounted.

I would be glad to test this oddness further if you wish.
Just tell me what to do.



2003-02-15 00:31:13

by Andrew Morton

[permalink] [raw]
Subject: Re: swap never cleaned up

Siim Vahtre <[email protected]> wrote:
>
> Hi.
>
> Since moving from 2.5.59 to 2.5.60 I've noticed some strange
> behaviour with swap managment. For some unknown reason the
> swapspace starts to fill up but it will NEVER get freed.
> Hence, it is first time in my life when I actually see swap
> used more than 20M on this computer!

Everything seems OK here, from a quick swap and tmpfs test.

Is it possible that some application is leaking memory, and that
swapoff causes it to be oom-killed?

Take a careful look at the process listing, see if some process is using a
lot of memory. Also the contents of /proc/meminfo. And see if you can work
out what operation is causing this.

Thanks.