RE: Specific Swap Usage

From: David Schwartz <davids_at_webmaster.com>
Date: Wed, 27 Feb 2008 17:16:35 -0800
> is there any way to look what programs are swapped out and how much
> memory they use? Looking at SIZE in top is just a wild guess.

There are really only two reasons SIZE might not do what you want, and it's
quite possible neither applies. In which case, you should use SIZE.

1) A process may have mappings that don't use nearly as much physical memory
or swap space as the mapping might suggest. Programs that 'mmap' large files
or use weird sparse arrays may do this. If you know a program doesn't do
this, this isn't a problem.

2) SIZE doesn't distinguish between physical memory and swap. But there's
really no logical reason you should care. The OS can always put something in
swap in physical memory and something in physical memory in swap. What you
are really running out of is swap plus physical memory anyway. (For example,
if a program relinquished 16MB of physical memory, that would help you at
least as much as it relinquishing 16MB of swap.)

> One server
> here grows in swap usage and panics eventuelly when all swap is usage.
> Swap usage is growing slowly (100 MB /week ) but it is growing and see
> no way to get what really uses swap :( (Read man ps three times
> already :/)

Is SIZE rising for this process too? Odds are it is, and you should try to
figure out why. If it turns out to be something harmless, that's fine. But
odds are very high this will point the way to your problem.

If all else fails, you can parse /proc/<pid>/map to figure out what mappings
the process has and what type they are. This will allow you to subtract
mmap'ed files that use vm space but not swap+physmem.

DS
Received on Thu Feb 28 2008 - 00:27:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:28 UTC