jsa said the following on 06/13/2011 12:14 AM:
On 06/12/2011 07:46 AM, Anton Aylward wrote:
The 'swapon' command will tell me how much swap is being used.
Is there anything that will tell me what is using swap, what programs, processes etc are using it or what the contents of swap is?
You can tell how much is being used, but getting a breakdown of what is using swap is sort of an oxymoron.
Dirk said I was asking the wrong question: well almost; I was asking the question backwards. You are right: 'top' can tell me what I need to know.
Swap is used to warehouse things that are not being uses, memory for programs that are not being run. If they were being run, they wouldn't be in swap.
That statement was literally correct with the old PDP-11 which ran in roll-in/roll-out mode. But with paged virtual memory a process can be running even if a lot, perhaps most of its memory is not 'in core'. Only its working set needs to be in core. And the way memory is mapped, the executable parts never need to be swapped out; when they fall of the end of the page LRU they are discarded because they can be retrieved from the binary image in /lib:/usr/lib:/bin:/usr/bin or wherever.
If a burst of high memory usage pushes inactive programs and work space to swap it will get paged back into main memory when it needs to run again. If it doesn't need to run, it might live out there on swap for a long time.
And that's where it has become odd. I have a little widget telling me cpu, memory and swap use. (Mathew Dawson's "System Load Viewer") For a long time I though that the 30% use of swap was because of all the web pages I had under tabs in Firefox. Some days that would reach 60% or 70%. But suddenly that's not happening any more. I still have the same 30-40 tabs, but now swap use in single digits. Even with day long sessions during which I view many more pages, look at spreadsheets and graphics-heavy presentation with LO, download and read PDFs ..
More to the point, there is no need to worry about swap, or memory management in general on Linux. Its not windows, and it will use memory and swap to the best advantage. These days, if you see any significant swap usage you probably need more memory.
All this I know; as I said, I've been doing this since PDP-11 days :-) I know full well that Linux - and even old UNIX - could make use memory if you threw more at it, something that Windows never really mastered (after all, why would any want more than 640k?) What I'm concerned about is the SUDDEN CHANGE IN BEHAVIOUR.
Until you see massive io and sustained disk activity and top shows your swap space being gobbled up, and your machine gets slow, just don't worry about swap.
That's exactly what I mean. That _was_ happening, now its not. I've not updated the kernel. I'm sure some apps have been updated in the normal course of events, but this seems a dramatic change. Its as if some major .memory leak has been fixed. -- The spirit of resistance to government is so valuable on certain occasions that I wish it to be always kept alive. It will often be exercised when wrong, but better so than not to be exercised at all. --Thomas Jefferson -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org