Unix Technical Forum

swap

This is a discussion on swap within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Is there a way to empty the swap partition? I know it's handled by the system, but I had ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-20-2008, 11:43 AM
lucas
 
Posts: n/a
Default swap

Is there a way to empty the swap partition? I know it's handled by the
system, but I had a program that terminated abruptly and left my swap full.
I had to reboot to clear it out, which I wasn't too impressed with. If
you're wondering, I was running PSAD and it was having a hard time with the
amount of dropped SYN packets I was getting.
--
lucas
-------------------------
Perl Coder since 2001
shift || die;
-------------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-20-2008, 11:43 AM
Keith Keller
 
Posts: n/a
Default Re: swap

On 2005-10-24, lucas <aolblowz@yahoo.com> wrote:
> Is there a way to empty the swap partition? I know it's handled by the
> system, but I had a program that terminated abruptly and left my swap full.
> I had to reboot to clear it out, which I wasn't too impressed with.


I have never heard of such a thing happening. I don't know if swapoff -a
would work, but next time it happens give it a try. If it works,
swapon -a would turn swap back on.

--keith


--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
see X- headers for PGP signature information

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-20-2008, 11:43 AM
lucas
 
Posts: n/a
Default Re: swap

Keith Keller wrote:


> I have never heard of such a thing happening. I don't know if swapoff -a
> would work, but next time it happens give it a try. If it works,
> swapon -a would turn swap back on.
>
> --keith


I had tried swapoff when it happened. It locked up the system.
Regards,
--
lucas
-------------------------
Perl Coder since 2001
shift || die;
-------------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-20-2008, 11:43 AM
Grant
 
Posts: n/a
Default Re: swap

On Mon, 24 Oct 2005 19:54:25 -0400, lucas <aolblowz@yahoo.com> wrote:

>Keith Keller wrote:
>> I have never heard of such a thing happening. I don't know if swapoff -a
>> would work, but next time it happens give it a try. If it works,
>> swapon -a would turn swap back on.


>I had tried swapoff when it happened. It locked up the system.


In that case you were in the middle of a swap storm and impatient?

Turning off swap appears to lock the system as it must search and
discard stale (dead) memory in order to bring swapped out (live)
memory back into core.

During this process, the kernel should be given some alternative
swap space, perhaps a swapfile ~16MB (wild guess) so that urgent
allocations may be satisfied --> Example: some service needs > 4kB
contiguous memory _now_, it wants to evict something quickly or die,
eg. incoming net traffic data buffer.

Grant.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-20-2008, 11:43 AM
lucas
 
Posts: n/a
Default Re: swap

Grant wrote:

> On Mon, 24 Oct 2005 19:54:25 -0400, lucas <aolblowz@yahoo.com> wrote:


>
> In that case you were in the middle of a swap storm and impatient?
>
> Turning off swap appears to lock the system as it must search and
> discard stale (dead) memory in order to bring swapped out (live)
> memory back into core.
>
> During this process, the kernel should be given some alternative
> swap space, perhaps a swapfile ~16MB (wild guess) so that urgent
> allocations may be satisfied --> Example: some service needs > 4kB
> contiguous memory _now_, it wants to evict something quickly or die,
> eg. incoming net traffic data buffer.


I had waited for the hard drive to settle down before I did that. But, next
time this happens, I'll create a temporary swap file. Thanks for the idea.

Regards,
--
lucas
-------------------------
Perl Coder since 2001
shift || die;
-------------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-20-2008, 11:43 AM
Henrik Carlqvist
 
Posts: n/a
Default Re: swap

lucas <aolblowz@yahoo.com> wrote:
> Is there a way to empty the swap partition?


Usually there is no need to "empty" the swap partition(s). Memory placed
on swap is memory that is not being actively used by any program. If a
program wants to use the memory again it will be read back to ram.

To force all swap memory being read back to ram would only be a waste of
ram which could be used for better things like disk cache.

> I know it's handled by the system, but I had a program that terminated
> abruptly and left my swap full. I had to reboot to clear it out, which I
> wasn't too impressed with.


If a program really dies it usually gives all of its memory back to the
system. There is an exception to this rule, and that is programs using
system V IPC. Those programs can leave memory used for interprocess
communication which no program is responsible for giving back.

Was your program really dead? If so, did it use system V ipc? If you want
to clean up after such a program without a reboot you should read the
manpages of ipcs and ipcrm.

regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc7(at)uthyres.com Examples of addresses which go to spammers:
root@variousus.net info@k-soft.se info@k-software.biz root@localhost

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:11 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com