Swappiness size

Hello all,
quick question, how do I modify the swappiness of my sistem.
My intent is to use swap ONLY when really needed.
So far I have used this setting
In etc/sysctl.d/99-sysctl.conf --> vm.swappiness=1
But I often discover that the OS uses some SWAP :

I have read this post
Did the location of this moved to /etc/sysctl.d/100-manjaro.conf ? Should I create the "100" file like I did the with the "99" with the line vm.swappiness=1 ?

It doesn't matter in which file you insert it.
I would suggest a value of 10 by the way, 1 is too low IMHO.

Not necessarily a bad thing.

1 Like

I found swappines 20 a fair setting. With 1 I got often freezes, then I changed to 20 and many my swapfile dynamic and that solved the problem entirely.

i go with swappiness of 100 since I have a SSD. So it will swap out what can be swapped out and my RAM is free for things that come and go fast.

I'm I the only one who doesn't bother running swap at all?

I barely see my ram usage ever going over 3gb (while running a vm) and mostly at under 1gb. On a 8gb laptop, what's the use of swap at all?

Honest question.


I’m with you, my personal system has no swap. I’ve got 16GB ram and never seem to use much more than 10GB. That’s only so high as it’s when i’m running a VM.

1 Like

Do you set swappiness to 0, then?

I also have 16GB RAM on my laptop, have never once touched swap, but I keep a 16GB swapfile around for hibernation. Thing is, I've not once used hibernation. I usually suspend or power off. I guess I might as well get rid of it.

I don’t think it matters what you have it set as if you have no swap partition, with no partition it has nowhere to swap to regardless of swappiness setting.

But if you want to keep a partition for hibernation as you mentioned and not use swap then you’d have to set the swappiness to zero.

1 Like

I am pretty sure this will wear out your SSD much sooner. If you find your system not freezing or reaching limits then why even use swap? I too have SSD and therefore I disabled swap to keep it's life as long as possible.

I don't think so. I don't have first gen SSDs and for modern ones this myth is busted already.

Because I want to use my ram for fast workloads, not to hold applications that are not often used, but running.

I'm also using dynamic swap, so by default no swap at all and often I end with a 512mb swap file. In some bad cases a bit more. Nothing I worry about. :+1:

1 Like

True, but SSD is not as fast as RAM. Why use swap when I got 8 Gb or RAM ?
With swappiness set to 0 I still get a little bit of swap.
That's why I asked if I have to set the swappiness from other file ?

Even if you have lots of ram sometimes having the swap space comes in handy. I have encountered a few memory leaks that never ended up crashing my system because I had swap enabled. I think it is a good cushion to have even if it is rarely ever used.

1 Like

Because swap can be useful (it is useful). If you don't want your computer to use swap, disable the swap partition. Or use zram - which is what I do on my 8 GB laptop.

As I already said, it doesn't matter in which file under /etc/sysctl.d/ you put vm.swappiness=1.

A good SSD will outlive all your computer's other components in a normal usage scenario.


Do you hibernate or use hybrid sleep?

nope, I do not

Well, the only reason I see for using swap with swappiness=1 is your RAM getting nearly full at some point. Anyway, you can just stop using swap (turn off swap, remove it from fstab, delete the partiiotn/file, delete the sysctl config and reboot).

Value of 100 doesn't mean it will prefer swap over ram. It will just swap out not used parts earlier.


For now I will leave it like 10
As @tbg said, if I disable it all together, maybe some buggy programs will freeze my system.


Yea, nothings wrong with that. We all have our comfy-settings :+1::nerd_face: it's like when it comes to wallpapers.

1 Like

and a follow up question :
should I also add tot the file 99-sysctl.conf , the line vfs_cache_pressure=10 ?
And if so, what number would you recommend for this ?

PS : I have read this , but for me is still a little too much info ...

Forum kindly sponsored by