SlackwareThis Forum is for the discussion of Slackware Linux.
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.
hi
when i do free -mt, most of my memory is used up but none of my swap space is. it's not even 1KB/MB. it's listed in my fstab, it shows up when i type mount. i've got a 500MB swap and 380MB ram/memory (approx).
now i'm glad that my memory is being used to the max, but shouldn't there be something in swap? to check if it's a load issue, i started about 10-15 gnome-terminals (with background and colors). comp did become a big jittery. mouse movement issues, took time to respond to swicthing apps, going to console. during all the loading, swap used was still 0. i've checked it during kernel compile and it's 0 even then.
this is my fstab entry. hdd7 is correct
/dev/hdd7 swap swap defaults 0 0
and in kernel, CONFIG_SWAP=y
i've tried swapon and off, doesn't make a diff to it's use.
Have you recieved any actual out of memory errors?
Linux will not normally swap anything to hard disk if it can avoid it by using physical memory, as it slows the system down.
One test you could do is to compile and run this program:
Code:
#include<malloc.h>
int main() {
while(0==0) {
if (0 == malloc(1024)) {
return 1;
}
}
return 0;
}
This program will constantly allocate 1kb of memory until it is killed or it runs out of memory.
While the program is running, watch your free swap space; it should gobble up all of it before the process dies. Some daemons may also get killed by this out-of-memory condition, so I'd suggest rebooting after this test.
Btw, you need CONFIG_SWAP in the kernel, or you won't be able to mount a swap partition or file at all.
You can also use
Code:
watch /proc/meminfo
to get a more detailed breakdown of the memory usage.
If this is a 2.6 kernel you might want to see what your swappiness setting is. IIRC you can set how much swapping your kernel will want to do. http://kerneltrap.org/node/view/3000
when i try # watch /proc/meminfo, i get 'permission denied'. related to this problem . i did 'cat' it, right now there's 220 MB of memory free. even when it comes down to 7-8 MB, if i start any heavy apps, it'll go down to 1-2 MB (which i see very often) but won't use swap.
now i'm glad that my memory is being used to the max, but shouldn't there be something in swap?
No. The less swap is used, the better. If you are getting basically zero swap usage that is a good thing; don't make changes to cause swap to be used. Why? -- access speeds within RAM are measured in nanoseconds, but access speeds to read data from the physical hard disk (ie, swap) are measured in milliseconds. That's about 6 orders of magnitude SLOWER than RAM, and therefore, the more your swap is used, the worse your performance will be.
Don't be concerned that the apparent memory usage seems to be so high; that is a function of how Linux manages memory. There is a good article by "sapphirecat" (read it here) on Linux memory management that may be of interest to you. In brief, if you run
Code:
free -m
you will see that your apparent usage (the first line) may seem very high, but the real stats are in the second line, because cached memory doesn't really count. -- J.W.
Distribution: SlackWare 10.1+, FreeBSD 4.4-5.2, Amiga 1.3,2.1,3.1, Windors XP Pro (makes a fair answering machine)
Posts: 287
Rep:
My systems actually hardly every use swap...
When I have noticed swap being used it is usually during very large multimedia streams this occurs even on boxes with high ram (>1gb).
Otherwise during "normal" ops the swap meters stay at "0".
@J.W.: thanks. good article. i normally use free -mt to see the memory states. the cache and buffer section in the article cleared up / gave info on quite a bit.
my swap is also at 0 always. i guess it would take some big file with alot of processing to actually use that swap.
Cool - just FYI some swap usage should be expected on an occasional basis, but as I mentioned you do ordinarily want to see it stay as close to zero as possible.
I don't know if you are using gkrellm but if not, you might want to check it out. It's an excellent way to keep tabs on important system functions at a glance, including swap and memory usage -- J.W.
In response, I have a similar problem. With the 2.4.26 stock kernel, I would eventually use like 8-20 mb of swap space after heavy usage. When I switched to the 2.6.7 kernel, dmesg informed me that my current swap partition version was obsolete, and that I should do "mkswap -v1 /dev/hda2" (im not at my home comp, so not 100% sure). Then do the "swapon /dev/hda2". Now when loading, I get a message displayed at boot like "swap on priority: -1" (ill post with exact details later). In similar tests, where I play like 30 DVD's at once on 2.6.7, all my memory dissappears and theres is absolutely no swap space ever used. This is my situation, and it sounds similar to yours, abs. If someone could shed some light on the subject, it would be much appreciated.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.