Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Where is my Swappiness Coming From Now? [Solved]

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
User avatar
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Where is my Swappiness Coming From Now? [Solved]

#1 Post by acewiza »

Last thing I did setting up a new 9.4 install was attempt adjusting swappiness. 1st try was a gksu/editor with my user logged into Gnome. System hung, restarted, no biggie. But swappiness returned to the stock setting of 60. Logged out, did it again from Nano in a root console - same result. The 60-value setting is obviously being re-applied at boot. SO the topic question remains - any advice? Or possibly, why am I attempting to do this incorrectly? :oops:
Last edited by acewiza on 2018-03-16 02:58, edited 1 time in total.
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Where is my Swappiness Coming From Now?

#2 Post by bw123 »

I've never really seen the need to change from the default, but I have had questions about swap and saved some links...

http://northernmost.org/blog/swap-usage-5-years-later/
http://www.linuxjournal.com/article/10678
http://blog.scoutapp.com/articles/2015/ ... -you-worry
Kernel maintainer Andrew Morton has stated that he uses a swappiness of 100 on his desktop machines, "my point is that decreasing the tendency of the kernel to swap stuff out is wrong. You really don't want hundreds of megabytes of BloatyApp's untouched memory floating about in the machine. Get it out on the disk, use the memory for something useful." TL;D
resigned by AI ChatGPT

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Where is my Swappiness Coming From Now?

#3 Post by p.H »

What file did you edit exactly and what did you write into it ?
You did not try to edit /proc/sys/vm/swapiness directly, did you ?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Where is my Swappiness Coming From Now?

#4 Post by Head_on_a_Stick »

deadbang

User avatar
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Re: Where is my Swappiness Coming From Now?

#5 Post by acewiza »

I'm guessing next I'll be told it's always been like that? :)
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Where is my Swappiness Coming From Now?

#6 Post by Head_on_a_Stick »

^ Hey, look, I was going to link you to this:

http://forums.debian.net/viewtopic.php?f=30&t=47078

But you seem to make some good contributions around here generally so I thought I'd let you have one for free :mrgreen:
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Where is my Swappiness Coming From Now?

#7 Post by p.H »

acewiza wrote:I'm guessing next I'll be told it's always been like that?
I do not understand what you mean. Could you please elaborate ?

User avatar
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Re: Where is my Swappiness Coming From Now?

#8 Post by acewiza »

p.H wrote:
acewiza wrote:I'm guessing next I'll be told it's always been like that?
I do not understand what you mean. Could you please elaborate ?
I just directly edited /proc/sys/vm/swappiness before. Was I stupidly not actually doing anything? Wow. I thought it was doing something. System Placebo effect.
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

User avatar
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Re: Where is my Swappiness Coming From Now?

#9 Post by acewiza »

Head_on_a_Stick wrote:^ Hey, look, I was going to link you to this:

http://forums.debian.net/viewtopic.php?f=30&t=47078
A search on swappiness in this site did not return any useful information in the 1st page of hits. I'm still curious where I got the idea (years ago) to edit /proc/sys/vm/swappiness. Am I having another systemd epiphany?
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

User avatar
makh
Posts: 651
Joined: 2011-10-09 09:16

Re: Where is my Swappiness Coming From Now?

#10 Post by makh »

Hi

You can do:

nano /etc/sysctl.d/99-sysctl.conf
---
# Changing the swap usage: decreasing it:
vm.swappiness = 10
vm.vfs_cache_pressure = 50

Reboot

Read docuementation, if you need changes.
ThinkPad E14: Arch, Debian Stable
GUI: Xfce

For new: Try MX Linux, Linux Mint; later join Debian Stable

Bulkley
Posts: 6386
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: Where is my Swappiness Coming From Now?

#11 Post by Bulkley »

I think adjusting Swappiness is out dated. Modern computers have so much memory that the issue is moot.

User avatar
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Re: Where is my Swappiness Coming From Now?

#12 Post by acewiza »

Bulkley wrote:I think adjusting Swappiness is out dated. Modern computers have so much memory that the issue is moot.
There is still management overhead, unless it is set to zero, more the higher it is set. Probably insignificant, so I guess you're right, for all practical purposes.

And I don't get the logic here: "...hundreds of megabytes of BloatyApp's untouched memory floating about in the machine."

Apps I'm not using on a regular basis get closed. This particular 16Gig system typically uses around 50-60% RAM, depending on the number of VM's it is presently running. It will experience a noticeable slowdown occasionally, because launching another VM (which uses big chunks of RAM) at some point will start swapping when it doesn't really need to - unless swappiness is turned down.

I think the whole Swap thing is an outdated holdover from the bygone era when systems always seemed to be RAM or storage challenged in one way or another. SO again, it certainly seems "outdated" on it's face now.
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Where is my Swappiness Coming From Now?

#13 Post by Head_on_a_Stick »

acewiza wrote:edit /proc/sys/vm/swappiness
That file gets recreated afresh every boot so to change it permanently a sysctl setting is needed ;)

See proc(5) for more.
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Where is my Swappiness Coming From Now? [Solved]

#14 Post by p.H »

/proc is not a real filesystem, and anything under it is not a real file. It is just a convenient user interface to the kernel internals. And of course its contents is volatile.
So you must not use an editor to write into /proc/sys (the writable part in /proc), because editors usually expect to work on regular files. One mostly write values in /proc/sys with

Code: Select all

echo "value" > /proc/sys/parameter
or

Code: Select all

sysctl -w parameter="value"
A value can be set at startup with config files such as /etc/sysctl.{conf,d/*.conf}.
Bulkley wrote:I think adjusting Swappiness is out dated
What you think is irrelevant to this thread.
acewiza wrote:And I don't get the logic here: "...hundreds of megabytes of BloatyApp's untouched memory floating about in the machine."
Apps I'm not using on a regular basis get closed.
That's what you think, but you're wrong. Un bunch of processes are running and never closed. For example : the display manager which starts your desktop environment session. All these processes keep unused data in memory (often data which are used only at startup and shutdown). These unused data can be swapped out to disk so that the memory is available for more useful data.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Where is my Swappiness Coming From Now? [Solved]

#15 Post by bw123 »

p.H wrote:
acewiza wrote:And I don't get the logic here: "...hundreds of megabytes of BloatyApp's untouched memory floating about in the machine."
Apps I'm not using on a regular basis get closed.
That's what you think, but you're wrong. Un bunch of processes are running and never closed. For example : the display manager which starts your desktop environment session. All these processes keep unused data in memory (often data which are used only at startup and shutdown). These unused data can be swapped out to disk so that the memory is available for more useful data.

That is the way I understand it also. Many apps allocate memory they only use once, or allocate more than they need. The kernel is always swapping, whether it's to disk or other pages in ram. By decreasing the tendency to get this unused or rarely used out to the swap file, you reduce the amount available for active page swaps. Also this decreases the amount left for file caching, which can cause more i/o than the swap you are trying to stop.

It's all speculation though without running some benchmarks for particular use. It sounds trendy though to lower swappiness, like it only controls one thing. It's a pretty complicated subject.

The reason I was interested is because it seems swapping 'out' seems to he happening a lot more on stretch than it did on jessie. Especially after a week or so of uptime, and after many suspend/wake cycles. I was concerned about it, until I realized the stuff going out wasn't really ever being swapped back in, or at least not that I could notice.
resigned by AI ChatGPT

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Where is my Swappiness Coming From Now? [Solved]

#16 Post by p.H »

Allocating more memory than needed is not a problem, because the kernel does not immediately allocate any physical memory. Physical memory pages are allocated on the fly when they are actually used (page fault).

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Where is my Swappiness Coming From Now? [Solved]

#17 Post by bw123 »

p.H wrote:Allocating more memory than needed is not a problem, because the kernel does not immediately allocate any physical memory. Physical memory pages are allocated on the fly when they are actually used (page fault).
That's a good point, what I was thinking was not really more than needed and never used, but more than needed in a certain situation. For instance, I'm pretty sure that firefox-esr allocates a buttload of memory somewhere somehow for playing audio/video, which I never use at all through the browser. This can go to swap on disk and get out of my way and I have more physical ram for what I actually do. Just speculation though, I haven't really dug into it that much. Xorg and some terminal programs seem have pages that get swapped out to disk easily also.

I'd like to explore better ways to pin it down, so far I've been using top, hitting f, selecting swap with spacebar, then q and watching a little while. there's got to be a better way...
resigned by AI ChatGPT

Post Reply