[kde-linux] VM and Swap problems
Randy Kramer
rhkramer at gmail.com
Sun Jan 28 17:33:39 UTC 2007
On Sunday 28 January 2007 03:48 am, James Richard Tyrer wrote:
> My system has developed an odd problem.
Wonderful! ;-) Well, sort of--I've had a similar problem for a long time with
no good resolution--more below.
> I have about 1 GByte of disk swap space and 7/16 GByte of RAM.
Just to clarify, I guess you mean 7/16ths of a GB? (like 512 + ~83 MB or
such)?
> The VM and swap work fine till the swap space is half full. But, after
> swap is half full the system starts removing swap until it is exactly
> half full. When this happens, the VM system starts to thrash and the
> system won't do anything till the thrashing stops.
I've had a problem like this through quite a few versions of Mandrake/Mandriva
(I can't recall when I first noticed it--it may have been as early as
Mandrake 6.2.) I've always used kde, but I don't think it's a kde problem.
(Can I prove that--probably not really--I do use other applications.)
The workarounds that I am aware of:
* Add more RAM
* As suggested by someone else, use top or similar and when either you
notice swap approaching half full, or you notice a slow down, start stopping
and then restarting processes that are using a lot of memory. (I restart
net-monitor, any browser other than konqueror, konqueror, and kmail
regularly, in about that order. (I use browsers other than konqueror for
sites that don't work with konqueror.) (All of these applications seem to
have what I will call memory leaks--they gradually use more and more memory
the longer you use them and don't return it, for example, when you close a
web page or tab.) I base my decision on VIRT usage, although lots of people
feel that is not a very good indicator of "real" memory use.
* Another possible workaround might be to drastically increase the amount
of swap, so it is very difficult to reach the 50% usage figure. (I
originally couldn't decide whether my thrashing / slow response problems were
at the 50% of swap figure, or swap usage ~= available RAM (because in most
previous installations I installed (per the rule of thumb) swap equal to two
times RAM. In my most recent install, my swap is 3x RAM, and the slowed
response still occurs at 50% swap usage. (I'm not 100% sure the problem is
thrashing, but it is as good a guess as any--the disk does see a lot of
activity at this point.)
Some other things I do:
* run as little as possible especially servers--for example, I do not run
an MTA
Some other possible contributing causes (IMHO):
* I often wonder if this problem is partially a result of the (seemingly)
Linux philosophy that memory not in use is wasted memory? (For other
reasons, I'd like to have a pool of memory that is not in use at any
particular time, for example, so that when I go to start a new app, memory is
immediately available for it.)
* Similarly, I wonder if this problem is partially a result of the Linux
design of having one kernel (and memory handling philosophy, etc.) for both
workstations and servers? I'd really prefer to have memory handling
customized for my use as a workstation rather than any bias that might exist
towards handling it (memory) for a server.
Another thing I don't like about Linux and its use of memory is (maybe it is
mentioned above--maybe it is the unused memory is wasted memory philosophy)
is the way it keeps expanding.
Several times over the years I've drastically increased the amount of RAM
memory in my systems (I mean like doubling, first, iirc, from 8 to 16 MB ;-)
Each time I did that I initially did not change the distro (revision) I was
using (so I could compare memory / swap behavior before and after the
addition of RAM)--every time, with the same mix of applications, the RAM
memory in use and the swap usage increased to fill the available memory to
about the same percentage as before. In some cases I did notice improved
performance, in other cases it was so minor as to be undetectable (to me).
Darn, I was going to mention another point but it seems to have slipped my
mind.
Oh, wait, it had something to do with letting me have tools to control (or
influence) the use of memory in *my* system. Oh, and oh yes, I'm aware of
and have experimented with swappiness. That didn't seem very helpful to
me--somewhere I have some notes, but it seemed that I either maintained about
the same performance as before (i.e., the slowdown at 50% of swap in use), or
started having crashes. (Around this time I was using systems with 512 to
768 MB--the most my motherboards could handle.)
But the influence I'd like to have is a little different. I'll have to think
about it to try to articulate it. When I do, I'll write again.
Anyway, at least now there are two of us who have seen problems along this
line. (Maybe if we both write to Linus he will do something to make things
better ;-)
Randy Kramer
More information about the kde-linux
mailing list