You are not logged in.

#1 2018-06-16 10:08:01

TheLinuxUser
Member
Registered: 2018-05-24
Posts: 4

(Solved)Swap barely being used even when low off ram

Hello everybody I am writing to ask how to make it so that swap would be used  more aggressively? At the moment  it is barely being used even when ram is full

free -m example output under heavy ram usage.
                    total        used        free      shared  buff/cache   available
Mem:           3947        3702         112          22         132          50
Swap:          3999          44        3955

So far I have tried to
1.Manually running swapoff and  and swapon on  swap partition.
2.Using zram instead of swap partition.
3.Updating kernel.
4.setting vm.swappiness =100
5.Looking for solutions on google and checking out wiki  https://wiki.archlinux.org/index.php/swap
but nothing helped.

Last edited by TheLinuxUser (2018-06-19 11:56:09)

Offline

#2 2018-06-16 13:34:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,849

Re: (Solved)Swap barely being used even when low off ram

Why do you believe preferring SWAP over RAM is remotely close to a sane approach?

Read https://bbs.archlinux.org/viewtopic.php?id=231265 for a discussion on swap, oom killing and the meaning of life…

Offline

#3 2018-06-16 17:11:49

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,481

Re: (Solved)Swap barely being used even when low off ram

Well, it depends...
You have very little buffered/cached data, so probably file access will be slow, taken.

But since when the data/code you'd prefer to be in the swap area is staying in ram instead? Are you "using" it? Why do you really want it to stay in the swap instead of the ram?
Do you have some memory pages locked there, maybe?
Did you tweaked other /proc/sys/vm settings?
Is that a test case or real usage?
Linux is pretty good in that from my experience.
Here, even with swappiness=0, with16GB of ram, 2 of which currently used and a peak of 4GB, it is using 12MB of swap space, uptime is about one week though.

Last edited by kokoko3k (2018-06-16 17:34:44)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#4 2018-06-17 11:43:50

TheLinuxUser
Member
Registered: 2018-05-24
Posts: 4

Re: (Solved)Swap barely being used even when low off ram

I want swap to be used to avoid freezing when running low off ram.I don't know for how long do I have this issue(probably for a while) but its arch linux specific problem.I made a small test with tmpfs I tried to fill it to test swap consumption.
On arch linux it simply freezed after running out off ram while swap  was barely used
However on other distro(debian)  swap is working fine I can easily reach 1.5 gb swap usage on same test while on arch its just some  megabytes.
I was just wondering how to make swap on arch linux to be used more aggressively 
in systemctl.d config directory the only change I made is vm.swappiness =100

Offline

#5 2018-06-17 12:32:00

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,849

Re: (Solved)Swap barely being used even when low off ram

lmg: lvm?

Offline

#6 2018-06-17 13:52:18

TheLinuxUser
Member
Registered: 2018-05-24
Posts: 4

Re: (Solved)Swap barely being used even when low off ram

I don't use lvm or encryption

Last edited by TheLinuxUser (2018-06-17 13:52:36)

Offline

#7 2018-06-17 15:58:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,849

Re: (Solved)Swap barely being used even when low off ram

Does the problem only apply to your artificial test on tmpfs?
Is it the same swap device (or maybe a partition vs. a file)?
Did you try the LTS kernel?

How do you define "freeze"? Is this in some desktop environment? What if you try this on the multi-user.target (console *only*)?

vm.swappiness does not make swapping more "agressive" but controls what to do when you get short on RAM (swap anon pages or drop file caches) - the swap will not be used when you've plenty of RAM left. The kernel maintains a minimum of free memory to do its job and that should suffice (while apparently does not when LVM mapping is required)

Filling tmpfs will load the inactive anon pages - this is not used, but neither droppable memory, so this will get swapped out and it will be the swapping act that slows down the system (for what reason ever)

Offline

#8 2018-06-17 19:36:52

TheLinuxUser
Member
Registered: 2018-05-24
Posts: 4

Re: (Solved)Swap barely being used even when low off ram

Not sure how but swap started working again and now it works properly I no longer get complete freeze when running low of ram.Thanks for the help.

Offline

Board footer

Powered by FluxBB