Swap space did not function when physical memory ( RAM ) is full
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.
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 ?
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.
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
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.
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.
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 ?
Quote:
Testing what?
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.
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):
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.