LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 06-12-2018, 06:33 PM   #1
Michael Piziak
Member
 
Registered: Feb 2015
Distribution: Ubuntu 14.04 lts
Posts: 183

Rep: Reputation: Disabled
Swap memory used before Ram depleted


Using "System Monitor" in Ubuntu, I see where I have 4 gigs of ram but when about 85% of it is used, the computer starts using Swap ram (the hard drive I suppose).

I just wonder why it doesn't wait until it has used 100% of the 4 gigs before it starts swapping ram and making my hard drive work harder.

I ordered another 4 gigs ram from "Crucial.com." Will more ram keep it from using the swap ram?

Michael
 
Old 06-12-2018, 06:53 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 18,364

Rep: Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737
Not usually.
Just not the way swap and kernel and some programs work exactly.
One might set some settings to adjust that value or remove swap. See swappiness maybe for adjust.

Using some swap isn't a real bad thing in many cases. Filling it could be an issue. Not even a rule of thumb anymore for amount. Generally distro's install some default amount.
 
1 members found this post helpful.
Old 06-12-2018, 07:08 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 16,836

Rep: Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507
It rarely (never) pays to completely fill anything up. Making room when all the queues are 100% is expensive - better to keep some leeway. Heuristics track allocation to try to keep some semblance of balance. swappiness is about all you can control unless you want to get into the memory management knobs. Not recommended as the knock-on effects can be disastrous.
 
Old 06-12-2018, 08:16 PM   #4
Michael Piziak
Member
 
Registered: Feb 2015
Distribution: Ubuntu 14.04 lts
Posts: 183

Original Poster
Rep: Reputation: Disabled
Thank everyone for your prompt replies.

Last question here: Will the extra 4 gigs of memory I ordered cut down on the % of swappiness?

Michael
 
Old 06-12-2018, 11:54 PM   #5
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 3,588
Blog Entries: 1

Rep: Reputation: 778Reputation: 778Reputation: 778Reputation: 778Reputation: 778Reputation: 778Reputation: 778
$ cat /proc/sys/vm/swappiness

This is a preference (default is 60 for most distros), where 0 is to NOT use swap (even if it exists). I tend to adjust that to 20-ish when swap / disk I/O gets in the way. Otherwise it's mostly moot if I'm not doing intensive things.

# echo 20 > /proc/sys/vm/swappiness
 
Old 06-13-2018, 07:21 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 11,120

Rep: Reputation: 3321Reputation: 3321Reputation: 3321Reputation: 3321Reputation: 3321Reputation: 3321Reputation: 3321Reputation: 3321Reputation: 3321Reputation: 3321Reputation: 3321
probably www.linuxatemyram.com will help you to understand it.
 
Old 06-13-2018, 03:54 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 18,364

Rep: Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737
Someone here may know if installing ram after install affects any metric used in swap.

Verify the value set before and after ram install to test your distro.

Ram is never bad and 4G isn't much to add in the real world but it doubles what you have.
 
Old 06-18-2018, 11:40 AM   #8
Michael Piziak
Member
 
Registered: Feb 2015
Distribution: Ubuntu 14.04 lts
Posts: 183

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
Someone here may know if installing ram after install affects any metric used in swap.

Verify the value set before and after ram install to test your distro.

Ram is never bad and 4G isn't much to add in the real world but it doubles what you have.

I installed the extra 4 gigs of ram and now it doesn't swap any.

My hard drive doesn't run nearly as much now.

I dunno why, but my computer has a "loud" hard drive.
 
Old 06-18-2018, 01:44 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 18,364

Rep: Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737
Did the swappiness value change?
 
Old 06-18-2018, 02:24 PM   #10
Michael Piziak
Member
 
Registered: Feb 2015
Distribution: Ubuntu 14.04 lts
Posts: 183

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
Did the swappiness value change?
Only thing I use is "System Monitor" (in Ubuntu) and the Swappiness is graphically 0 now that I have 8 gigs ram.
 
Old 06-18-2018, 03:31 PM   #11
jefro
Moderator
 
Registered: Mar 2008
Posts: 18,364

Rep: Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737
We might have a definition issue. https://askubuntu.com/questions/1039...wappiness?rq=1
 
Old 06-18-2018, 06:05 PM   #12
Michael Piziak
Member
 
Registered: Feb 2015
Distribution: Ubuntu 14.04 lts
Posts: 183

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
How so?

I'm talking about the swap to HD virtual memory when most of the ram is used.
 
Old 06-18-2018, 06:51 PM   #13
jefro
Moderator
 
Registered: Mar 2008
Posts: 18,364

Rep: Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737
Swappiness is a way to set/adjust the way swap might be used rather than a function of swap amount.
 
Old 06-18-2018, 06:53 PM   #14
Michael Piziak
Member
 
Registered: Feb 2015
Distribution: Ubuntu 14.04 lts
Posts: 183

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
Swappiness is a way to set/adjust the way swap might be used rather than a function of swap amount.
I suppose I was talking about swap amount.

Regardless, adding RAM caused swap to go to 0.
 
Old 06-18-2018, 08:02 PM   #15
jefro
Moderator
 
Registered: Mar 2008
Posts: 18,364

Rep: Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737Reputation: 2737
Thanks for the update and solution.

There is really no substitute for ram and the more the better.....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
MemFree depleted in /proc/meminfo when writing to flash memory srivatsa231181 Linux - Kernel 1 09-01-2016 01:17 PM
Swap used even when ram is available after memory usage spike werner291 Linux - Newbie 9 08-08-2013 07:46 PM
RAM and swap memory problem ninadoak Linux - Newbie 1 09-19-2011 12:32 AM
Physical RAM and SWAP Memory devUnix Linux - Server 5 12-18-2010 08:51 AM
RAM/Swap Memory Code Errors ghe1 Programming 1 04-01-2002 07:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 10:35 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration