LinuxQuestions.org
Review your favorite Linux distribution.
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 10-13-2015, 01:41 PM   #1
m1m
Member
 
Registered: Jan 2011
Posts: 55

Rep: Reputation: 1
Swap keeps growing after hibernation restore


Hi,
I use Slackware 14.1 x64 with default kernel (3.10.17). I have 8GB ram and 10GB swap partition. I mainly use Opera 12 and I try to keep as much as I can in the ram. In normal conditions Opera takes ~3GB (I have many tabs opened) and total system usage is ~3,5GB-4,5GB. I also use ramdisk which is ~1GB.

When I boot system for the first time I have 0 swap usage. But when I hibernate & restore, swap usage goes +1,5GB, later it goes down 200-300 MB but after another hibernate & restore it goes up another 1,5GB and so on. I never goes back to 0 despite there is 4,5GB of free ram.

I thought that after restore from hibernation all swap is loaded back to ram and cleared (because there was nothing in swap before hibernation). I have set swappiness to 10. I use standard XFCE panel button to hibernate.

For example, this is memory usage after 3 hibernations with runnig opera:
Code:
free -m
             total       used       free     shared    buffers     cached
Mem:          7923       4782       3141          0        216        970
-/+ buffers/cache:       3595       4328
Swap:        10237       2540       7697
I run
Code:
vmstat 1
for a while and it dosen't show any swap usage.
 
Old 10-13-2015, 02:29 PM   #2
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
There will always be residual pages left in SWAP that don't get cleared. The only thing that gets loaded back into RAM are what is needed or most frequently used. Items that are not frequently used don't have to be read back into memory.

And swappiness is only used to instruct the system when to swap as the memory starts to become fully utilized.
 
Old 10-13-2015, 02:34 PM   #3
m1m
Member
 
Registered: Jan 2011
Posts: 55

Original Poster
Rep: Reputation: 1
OK, so what should I do then? After few more hibernations I'll run out of swap space...
 
Old 10-13-2015, 04:55 PM   #4
Hangaber
Member
 
Registered: Sep 2004
Location: USA
Distribution: Slackware
Posts: 163

Rep: Reputation: 51
Quote:
Originally Posted by lazydog View Post
[...]The only thing that gets loaded back into RAM are what is needed or most frequently used. Items that are not frequently used don't have to be read back into memory.[...]
My thoughts exactly.

I suspect what is happening is;
When you hibernate-to-disk, it sounds like your 'used' + 'cached' memory is being stored.
Upon the restore, the 'used' is read, but the 'cached' remains in swap. If the system needs anything from that cached data, it'll fetch it.

So I also suspect that; Just like if you run out of actual RAM, the unneeded 'cached' data will be dumped first from RAM. Likewise, if your swap gets full, the unneeded 'cached' data in that swap file will be discarded.
 
Old 10-13-2015, 05:18 PM   #5
m1m
Member
 
Registered: Jan 2011
Posts: 55

Original Poster
Rep: Reputation: 1
Thanks for answers, now it's more clear to me, but I think it's a bit ineffective - why use swap when there are loads of free ram? Anyway, is there any command to "move" swap back to ram?
 
Old 10-13-2015, 07:46 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Why swap it back in if it's never referenced ?. That would be a much more inefficient use of memory.

"swapoff" followed by "swapon" will clear swap.
If you have insufficient RAM, the swapoff will fail - then you'll know you really do have an issue.

All unnecessary IMHO, but it's your machine.
 
Old 10-16-2015, 07:46 AM   #7
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
A thing to remember is SWAP will take care of itself. The only time you have to worry about it is when you are working and it fills to capacity then you have a problem.
 
  


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
Encrypted swap & hibernation ? torimus Slackware 8 07-02-2013 06:03 PM
ubuntu11.10 hibernation it says not enough swap danddfaver Linux - Newbie 2 01-01-2012 01:28 PM
swap partition size for hibernation dimm0k Slackware 9 09-28-2010 05:01 AM
Proper swap size for hibernation dimm0k Linux - Laptop and Netbook 5 09-23-2010 11:14 AM
hibernation with two swap partitions in squeeze map250r Debian 4 07-29-2010 10:22 AM

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

All times are GMT -5. The time now is 06:08 PM.

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