Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
|
06-22-2009, 05:23 AM
|
#1
|
LQ Newbie
Registered: Mar 2009
Posts: 8
Rep:
|
Swap space did not function when physical memory ( RAM ) is full
Hi all,
The swap space did not function ( usage stay 0% ) when physical memory (RAM) is full. This cause the workstation hang.
Workstation model = xw4400
Physical memory size = 4G
Swap Space size= 4G ( 2G on each HD ).
Would like your help as following :-
1. Why the swap space did not function when physical memory is full ?
2. How to activate the swap space to function when physical memory is full ?
3. Any command to clear / initialize the RAM ?
free
total used free shared buffers cached
Mem: 4095376 4011452 83924 0 48808 2469584
-/+ buffers/cache: 1493060 2602316
Swap: 4096524 0 4096524
/proc/swaps
Filename Type Size Used Priority
/dev/sdb1 partition 2048248 18760 -1
/dev/sda2 partition 2048276 0 -2
/etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/sdb1 swap swap defaults 0 0
/dev/sda2 swap swap defaults 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
|
|
|
06-22-2009, 05:51 AM
|
#2
|
Registered User
Registered: Dec 2006
Posts: 1,454
Rep:
|
What distro and version are you using, and how was the drive partitioned?
I can't read your fine blue print, but it sounds like the swap space didn't get flagged as such. They need to be set as linux-swap by the partitioner.
|
|
|
06-22-2009, 05:51 AM
|
#3
|
Senior Member
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847
Rep:
|
What does the output of swapon -s give? Is the swap space actually on?
|
|
|
06-22-2009, 05:57 AM
|
#4
|
Senior Member
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687
Rep:
|
But it is used, at least /dev/sdb1:
Quote:
/proc/swaps
Filename Type Size Used Priority
/dev/sdb1 partition 2048248 18760 -1
/dev/sda2 partition 2048276 0 -2
|
from man fstab
Quote:
The second field, (fs_file), describes the mount point for the filesystem. For swap partitions, this field should be specified as `none'.
|
So, your swap lines should read:
Code:
/dev/sdb1 none swap defaults 0 0
instead of:
Code:
/dev/sdb1 swap swap defaults 0 0
with regard to the second field.
Actually, my entry differs at the fourth field as well - I have "sw" there instead of "defaults", like this:
Code:
/dev/sdb1 none swap sw 0 0
HTH
|
|
|
06-22-2009, 06:16 AM
|
#5
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,317
|
Why do you think your RAM is "full" ?.
Why do you think your swap isn't being "used" ?.
How is any of this affecting your machines performance ?.
|
|
|
06-23-2009, 01:47 AM
|
#6
|
LQ Newbie
Registered: Mar 2009
Posts: 8
Original Poster
Rep:
|
Hi all,
Thanks for the reply.
To dragonslayer48dx
Software : Linux Redhat 3 ( Taroon Update 7 )
HD partition :
/dev/sda
- sda1 102MB ext3
- sda2 2000MB linux-swap
- sda3 74214MB ext3
/dev/sdb
- sdb1 2000MB linux-swap
- sdb2 74316MB ext3
Note : The partition is auto partition during redhat installed with recovery disk.
To PWC101
swapon -s result is /proc/swaps file content ie.
Filename Type Size Used Priority
/dev/sdb1 partition 2048248 18760 -1
/dev/sda2 partition 2048276 0 -2
How to check whether the swap is on ?
To jomen
Did modify the fstab top portion before. It will cause all system cannot be boot up.
Only can recovered by new installation.
To syg00
Actually this workstation is used for test system.
During the program running. We open the info centre ( memory ) to do the monitoring.
We can notice the physical memory free space is slowly reduce from about 2G to 200M and then workstation hanged.
For the swap space memory. The usage is keep on 0%.
The testing speed is getting slower and slower ( from initial 20sec per test to 200sec per test ) and finally workstation hanged.
free
total used free shared buffers cached
Mem: 4095376 4011452 83924 0 48808 2469584
-/+ buffers/cache: 1493060 2602316
Swap: 4096524 0 4096524
/proc/swaps
Filename Type Size Used Priority
/dev/sdb1 partition 2048248 18760 -1
/dev/sda2 partition 2048276 0 -2
/etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/sdb1 swap swap defaults 0 0
/dev/sda2 swap swap defaults 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
|
|
|
06-23-2009, 01:57 AM
|
#7
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,317
|
Your swap is active else you wouldn't see it via "swapon -s" - but it is only used for dirty anonymous (malloc'd) memory.
See if you can get these commands to run just before a hang, and post the output
Code:
cat /proc/meminfo > meminfo.txt
cat /proc/slabinfo >> meminfo.txt
|
|
|
06-23-2009, 04:56 AM
|
#8
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Quote:
Originally Posted by rabbit00
free
Code:
total used free shared buffers cached
Mem: 4095376 4011452 83924 0 48808 2469584
-/+ buffers/cache: 1493060 2602316
Swap: 4096524 0 4096524
|
Your RAM isn't "full" ... you have got almost 2.5GB
free (kind of) that Linux just uses to cache files.
Cheers,
Tink
|
|
|
06-23-2009, 05:45 AM
|
#9
|
Senior Member
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687
Rep:
|
Quote:
Did modify the fstab top portion before.
|
You mean the lines pertaining to swap?
Quote:
It will cause all system cannot be boot up.
|
That _is_ stange then.
If an entry like
Code:
/dev/sdb1 swap swap defaults 0 0
works for you, then an entry like
Code:
/dev/sdb1 none swap sw 0 0
should work, too.
Quote:
Only can recovered by new installation.
|
Sorry - but I highly doubt that.
|
|
|
06-23-2009, 06:14 AM
|
#10
|
LQ Guru
Registered: Dec 2007
Distribution: Centos
Posts: 5,286
|
The following is a simplified version of the true behavior, but explains the important issues:
Most pages in memory are unmodified copies of pages in files on disk, for example the executable code of whatever programs are running.
Many of those unmodified pages aren't even mapped into the address spaces of tasks, they are just cached because they were read fairly recently and might get read again.
When memory is "full", the system must free some pages. It tries to free pages that have not been used recently, but with some amount of bias toward freeing pages that are unmodified copies of pages on disk.
If it happens to decide to free a page that is not an unmodified copy of disk, it will need to write that page to swap space before really freeing it, and later will probably need to read it back from swap space.
If it decides to free an unmodified page, it can immediately free that page. If the page is needed in memory again later, the system can read the page again from wherever it is on disk.
|
|
|
06-23-2009, 06:22 AM
|
#11
|
LQ Guru
Registered: Dec 2007
Distribution: Centos
Posts: 5,286
|
Quote:
Originally Posted by rabbit00
Actually this workstation is used for test system.
|
Testing what?
Quote:
We can notice the physical memory free space is slowly reduce from about 2G to 200M and then workstation hanged.
|
I would need to see the output from free before and after a significant fraction of that reduction to reach any conclusions about what it means. The info you provided tells less than you think it tells.
Quote:
The testing speed is getting slower and slower ( from initial 20sec per test to 200sec per test ) and finally workstation hanged.
|
Based on what you said so far, I would not guess anything is wrong with the swapping and I would not guess that the hang was caused by physical memory being full.
Zero swapping is probably a correct behavior under these conditions.
My guess at the leaking resource causing the problem is virtual memory, not physical memory. But without more info, that isn't more than guess and I don't know which virtual memory.
Quote:
During the program running.
|
Quote:
The testing speed is getting slower and slower
|
Is each test a whole run of the program start to exit? Or is it an operation within an already running program?
The second allows for very simple and common problems exhausting the virtual memory within that program. The first would require a much more drastic bug to exhaust any resource.
BTW, the info you displayed from free showing zero swap use was inconsistent with the info you displayed from other tools that showed minimal swap use. I assume that is not a symptom of any complicated issue, but just means you ran free under different conditions than the other tools.
Last edited by johnsfine; 06-23-2009 at 06:32 AM.
|
|
|
06-23-2009, 12:01 PM
|
#12
|
LQ Newbie
Registered: Mar 2009
Posts: 8
Original Poster
Rep:
|
Quote:
Your swap is active else you wouldn't see it via "swapon -s" - but it is only used for dirty anonymous (malloc'd) memory.
See if you can get these commands to run just before a hang, and post the output
Code:
|
Currently the workstation is temporary running other devices.
Already do a cron job to execute the code given for every 1 mins.
Will try to get the information once the workstation is available for debugging.
Quote:
Your RAM isn't "full" ... you have got almost 2.5GB
free (kind of) that Linux just uses to cache files.
|
Is it mean that after the physical memory is full, it will start using cache files then swap space ?
This workstation is used for ATE ( Automatic test equipment ).
It's test wafers and IC chips.
Quote:
Is each test a whole run of the program start to exit? Or is it an operation within an already running program?
|
The program ( test program )is never exist during test the IC chips.
The sequence of testing is Received IC chips --> start test --> end test --> change another chips --> start test --> end test... until finish testing all IC chips. then the program is existed.
Quote:
BTW, the info you displayed from free showing zero swap use was inconsistent with the info you displayed from other tools that showed minimal swap use. I assume that is not a symptom of any complicated issue, but just means you ran free under different conditions than the other tools.
|
Yes, you are correct. The "free" is ran during the program is half-way running ( approaching physical memory full ). Anyway, we are not able run the "free" when the workstation is hanged.
|
|
|
06-23-2009, 03:14 PM
|
#13
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Well ... to find out what the memory status was at death
you could do something like this (assuming you've set-up
password-less ssh authentication for a user on the test
machine to some other Linux box):
Code:
watch -n 1 'free | ssh user@otherbox "cat >> ~/memory_use"'
And then watch how it goes.
Cheers,
Tink
|
|
|
06-23-2009, 03:17 PM
|
#14
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Quote:
Originally Posted by rabbit00
Is it mean that after the physical memory is full, it will start using cache files then swap space ?
|
The Linux kernel is pretty good at making guesses
what makes most sense in terms of using RAM efficiently.
Only when processes really need RAM it will take sensible
caching away. Chances are it will put some less used
code into swap before cache decreases. However, you will
not see an out of memory condition w/o having even touched
swap.
Cheers,
Tink
|
|
|
06-23-2009, 05:20 PM
|
#15
|
LQ Guru
Registered: Dec 2007
Distribution: Centos
Posts: 5,286
|
I now think you are running out of kernel virtual memory or some resource closely related to kernel virtual memory.
I don't know how to report on usage levels of those resources. Maybe someone else here does.
I don't think you are running out of user mode virtual memory, because you said the whole system is hung, you can't even use free.
I don't think you are running out of physical memory, because
Quote:
The "free" is ran during the program is half-way running ( approaching physical memory full )
|
was far short of half way to physical memory full even assuming the swapping system is broken and shows no evidence it is even on its way to physical memory full.
Plus, there is no hint (other than your unsupported guess) that anything is wrong with the swapping system. With 4GB of swap under the conditions you describe, the system would slow down gradually. There would be plenty of time to run free after the system was quite sick, but before the system was too hung to even run free.
So that leaves some kernel resource based on kernel virtual memory limits.
|
|
|
All times are GMT -5. The time now is 11:32 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|