Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My computer has 6gb physical RAM, and a 6gb swap partition. After a 1-2 weeks of uptime of using chromium, skype, clementine, and dropbox, my memory statistics is as follows:
active: 3123
cache: 2242
free: 418
swap: 1612
I'm not so concerned about high memory usage, but rather concerned about cached memory that could be freed to make room for whatever is in the swap. Is that a not-so-good idea? Should I be doing something different to prevent the constant swap usage?
This is nothing to be concerned about. The system swapped out seldom used memory pages to have more space used as cache. This will actually increase the speed of your system, only when you use the application that is swapped out you will see a delay when the pages are loaded back into RAM.
Before I ask a dumb question could you please post two things?
/proc/meminfo
and
output of vmstat -a or at least vmstat if you have it.
About once every other week my computer fails to wake from sleep, and it happened just right now. Now my computer has only minutes of uptime, and has 3393 MB free memory. I don't start hitting swap until at least a couple of days so I can't imagine that info being of any use right now (right?).
Should I be doing something different to prevent the constant swap usage?
Having some swap pages in use is not, per se, a problem for normal operation. Having traffic to and from the swap volume is a problem...well, at least, a problem if the result is enough slowness to be a problem.
Quote:
About once every other week my computer fails to wake from sleep, and it happened just right now. Now my computer has only minutes of uptime, and has 3393 MB free memory. I don't start hitting swap until at least a couple of days so I can't imagine that info being of any use right now (right?).
This may or may not be a concern to you, but there may be a connection. That is, if you suspend to disk, you need enough swap space defined in order to swap to. If you are filling up your ram and you are using some swap space as well, there may well not be enough space to swap to. This will cause the symptom that you are having - as I say, it is not clear whether this is a problem to you, but, if it is, you could define another swap space (either make a partition available for that, by a bit of partition shuffling, or a swap file).
If it was me, I'd want to run vmstat now - now is when the system is running well, and a vmstat run now will give you the 'before' reference. If you run something like 'vmstat 2 10' now, and run it again, once your memory usage has gone up, you should be able to see the difference. (Also, have a look at the man page for vmstat; there is an important note about the first response.)
This may or may not be a concern to you, but there may be a connection. That is, if you suspend to disk, you need enough swap space defined in order to swap to. If you are filling up your ram and you are using some swap space as well, there may well not be enough space to swap to. This will cause the symptom that you are having - as I say, it is not clear whether this is a problem to you, but, if it is, you could define another swap space (either make a partition available for that, by a bit of partition shuffling, or a swap file).
If it was me, I'd want to run vmstat now - now is when the system is running well, and a vmstat run now will give you the 'before' reference. If you run something like 'vmstat 2 10' now, and run it again, once your memory usage has gone up, you should be able to see the difference. (Also, have a look at the man page for vmstat; there is an important note about the first response.)
Actually I already determined the sleep problem: buggy proprietary fglrx ATI drivers. Perhaps the drivers are related to swap, I don't know. There are several different workarounds for different thinkpad models but I have an ASUS with a different video card than those other laptops. I have not gotten around to attempting each fix, one at a time, partly because some workarounds warn that corruption is possible. I can switch to the open source drivers, which I have done in the past, and that does fix the problem but idles my video card at 75C rather than 66C (as with fglrx). High temperatures wouldn't normally bother me, but I do hate the sound of fans at high RPMs especially when I have sleeping roommates.
Furthermore I suspend to RAM, not disk. I'll note the vmstat anyway, thanks for your insight
About once every other week my computer fails to wake from sleep, and it happened just right now. ... I can't imagine that info being of any use right now (right?).
I don't have any guesses about the sleep issue. You don't seem to be saying you think it is related to the swap usage.
But anyway, you are correct that detailed memory stats would not be helpful if captured when the condition being investigated isn't happening.
Quote:
Originally Posted by TobiSGD
This is nothing to be concerned about.
Generally true. But I wouldn't rule out a memory leak based on the numbers posted, without more detailed info.
Quote:
when you use the application that is swapped out you will see a delay when the pages are loaded back into RAM.
Sometimes that is true, in which case the use of swap to increase caching has gained throughput (overall system speed) at the expense of responsiveness (perceived system speed) and most people would prefer responsiveness. But that "sometimes" seems less likely in this case and the controls are crude, so I suspect no responsiveness can be gained by reducing swap usage.
Many service processes use a lot of anonymous memory on startup that is then untouched until the service is shut down. With a light memory load, it may take days for the kernel to figure out those pages are stale, then it correctly swaps out the stale pages and leaves them out, which does no harm to the subsequent performance of those services. The amount of swap use here seems a bit high for that, but I don't know much about the specific service processes that are running. If this is the correct diagnosis than nothing is wrong and that use of swap space is optimal for both throughput and responsiveness.
Some process(es) might have memory leaks. That typically means the process gradually accumulates more stale pages that it owns but doesn't touch. The kernel gradually swaps those pages out and leaves them swapped out, which eliminates the major short term consequences of the memory leak. But eventually a memory leaking process will need to be shut down and restarted. Often the memory leaking process is the main GUI system, so shutting it down an restarting forces shutting down and restarting all GUI programs, which for most people is more hassle than completely rebooting.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.