LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-25-2004, 07:20 AM   #1
abs
Member
 
Registered: Oct 2003
Posts: 203

Rep: Reputation: 30
swap space used: 0; memory used: 90-95%


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.

ty
abs

Last edited by abs; 08-25-2004 at 07:22 AM.
 
Old 08-25-2004, 07:35 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
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.

Hope that helps,

— Robert J. Lee
 
Old 08-25-2004, 07:58 AM   #3
ringwraith
Senior Member
 
Registered: Sep 2003
Location: Indiana
Distribution: Slackware 15.0
Posts: 1,272

Rep: Reputation: 65
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
 
Old 08-25-2004, 01:30 PM   #4
abs
Member
 
Registered: Oct 2003
Posts: 203

Original Poster
Rep: Reputation: 30
swappiness is set to 60.

i have configured swap into the kernel.

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.

gonna try setting swappiness to 100.
 
Old 08-28-2004, 12:30 PM   #5
abs
Member
 
Registered: Oct 2003
Posts: 203

Original Poster
Rep: Reputation: 30
setting it to 100 hasn't changed anything. still behaves the same way.
 
Old 08-28-2004, 04:48 PM   #6
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
Quote:
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.
 
Old 08-29-2004, 05:13 AM   #7
Nichole_knc
Member
 
Registered: Mar 2004
Location: Georgia
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: Reputation: 30
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".
 
Old 08-29-2004, 06:00 PM   #8
abs
Member
 
Registered: Oct 2003
Posts: 203

Original Poster
Rep: Reputation: 30
@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.

abs
 
Old 08-29-2004, 08:21 PM   #9
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
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.
 
Old 08-30-2004, 12:33 PM   #10
GodSendDeath
Member
 
Registered: Mar 2004
Posts: 71

Rep: Reputation: 15
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.

-GSD
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to reduce swap space and reclaim the space grantm Linux - Newbie 7 08-16-2012 07:05 AM
No swap space Zerimas Linux - Newbie 7 03-10-2005 06:08 PM
not enough memory to run YaST,enable swap space, but can't ArtsWorks Linux - Newbie 8 09-13-2004 08:59 AM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration