Steam Deck

Steam Deck

Swappiness is set all the way to 100
in the file /etc/sysctl.d/swappiness.conf the vm.swappiness option is set all the way to 100.
this causes the kernel to treat RAM and swap on the SSD as fully equal options to store memory.
This can lead to a lot of unnecessary read and write cycles to be used up on the SSD affecting its health. performance loss may also also occur due to memory being stored is the slower swap while plenty of RAM is still available.

Steps to reproduce:
  1. the current swappiness level can be found by running '# sysctl vm.swappiness'
  2. the permanent swappiness configuration can be found in /etc/sysctl.d/swappines.conf
< >
Showing 1-15 of 21 comments
StepBro Oct 15, 2022 @ 3:37pm 
This is absolutely a terrible default for vm.swappiness and how you page an SSD to death.
ShrapNull Nov 2, 2022 @ 4:42am 
What value do you recommend setting swappiness to on steam deck?
Please explain why - still learning here.

Thanks :)
Prezidentas Nov 2, 2022 @ 5:24am 
launched doom and it didn't swap anything. Maybe it has some other changes that make it unlikely to swap, or the kernel is smart enough not to use swap.
Originally posted by ShrapNull:
What value do you recommend setting swappiness to on steam deck?
Please explain why - still learning here.

Thanks :)
other operating systems including arch which steamos is based on set swappiness to 60
StepBro Nov 3, 2022 @ 10:35pm 
Actually recommend just not using swap. It's a relic of an era where RAM was limited to KB's and MB's.


swapoff -a

remove it from /etc/fstab
Last edited by StepBro; Nov 3, 2022 @ 10:36pm
Arazil Nov 3, 2022 @ 10:47pm 
The default swappiness value for an Arch Linux system is: 60

I would like to see better defaults for and management of Steam Deck swap parameters. I would also like to see support added for "zram" based swap configurations.
SubWorx Nov 4, 2022 @ 3:49am 
that's interesting, something i'll change and see how the device behaves.
also found out steamOS generally supports zram, but didn't manage to set it up (Linux sort of noob)
SubWorx Nov 4, 2022 @ 3:50am 
Originally posted by Moot:
Actually recommend just not using swap. It's a relic of an era where RAM was limited to KB's and MB's.

RAM is very limited on the deck. 16GB installed, of which at least 1GB is used for Viddeo RAM.
Some games llike RDR2 pretty much require 4GB VRAM, which leaves 12 to the OS and games - too little, so RDR2 still may crash until you increase swap to 4GB+ as well.
KickAssDave Nov 5, 2022 @ 11:02am 
Originally posted by SubWorx:
Originally posted by Moot:
Actually recommend just not using swap. It's a relic of an era where RAM was limited to KB's and MB's.

RAM is very limited on the deck. 16GB installed, of which at least 1GB is used for Viddeo RAM.
Some games llike RDR2 pretty much require 4GB VRAM, which leaves 12 to the OS and games - too little, so RDR2 still may crash until you increase swap to 4GB+ as well.

I have 16GB in my main gaming desktop and RARELY do I ever see a single game consume anywhere near 10GB. I'm not saying it doesn't happen, but my point is.. it's more than you think.

On top of this, you should be running most games on the Deck at medium/low texture settings and at native res 1280x800, these settings alone contribute massively to reduced RAM/VRAM usage.

I actually managed to get ZRAM working with the Deck, it had no effect on performance, but I was able only to force it to be used by basically intentionally cranking up RAM/VRAM usage in Shadow of War by setting the texture settings to "Ultra" which is totally unnecessary on the Steam Deck anyway...

Setting an 8GB ZRAM disk on the Steam Deck really isn't a bad idea and worth testing vs what happens when the system reverts to disk swap (which by default is only 1GB anyway)
Last edited by KickAssDave; Nov 5, 2022 @ 11:07am
StepBro Nov 11, 2022 @ 11:59pm 
Originally posted by SubWorx:
Originally posted by Moot:
Actually recommend just not using swap. It's a relic of an era where RAM was limited to KB's and MB's.

RAM is very limited on the deck. 16GB installed, of which at least 1GB is used for Viddeo RAM.
Some games llike RDR2 pretty much require 4GB VRAM, which leaves 12 to the OS and games - too little, so RDR2 still may crash until you increase swap to 4GB+ as well.

We use swap in the servers with the intent to prevent downtime from just a spike in memory usage. This is fine and is the intended purpose of swap, momentary spikes. Really good Linux admins know they don't want heavy swapping and actively avoid it. Monitoring on physical hardware should always include high memory usage and heavy swapping. Admins want to get the best value out of their hardware and ensure the most uptime possible; this is just what you have to do maximize efficiently for both.

The difference with the Steam Deck is that the user has no monitoring system to tell them they are heavily swapping. Games are much more likely to require heavy swapping if they are being played on under spec'd hardware than they are tuned for . The end user may not even notice anything is wrong if the experience is bearable enough to play. Unfortunately the drive will die much sooner than it ever needed to.

Swapoff should be the default on this type of device. They average user isn't an engineer with 20 years of Linux systems and programming knowledge; but instead casual gamer that would not want to inherit the risk involved long term.

As for us nerds that care about this stuff, we're knowledgeable enough to do whatever we want. This doesn't even apply to us. It's also very easy to forget inside the echo chambers where everyone is tweaking their systems, we aren't the average consumer. We also don't want to be fixing issues for our friends and family because of bad defaults.
Last edited by StepBro; Nov 12, 2022 @ 12:01am
sam Jan 26, 2023 @ 12:34pm 
$ swapon
maybe priority is something here
deaddoof Jan 26, 2023 @ 5:02pm 
OP, are you an OS engineer? I believe the Linux kernel knows the difference between SSD and RAM....

All OS performance devs say swap is a good thing. The OS memory allocator uses swap to reclaim pages. This process should happen even if main memory have plenty of space. You do not benefit stopping your housekeeper from doing its job.

https://www.youtube.com/watch?v=cSJFLBJusVY&t=702s
https://chrisdown.name/2018/01/02/in-defence-of-swap.html
https://prod.lwn.net/Articles/815342/
https://lwn.net/Articles/690079/

My criticism is the default 1GB swap is too small and has been known to be a bit problematic.

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1966381
xep Jan 26, 2023 @ 6:54pm 
From this very well written post linked above:
https://chrisdown.name/2018/01/02/in-defence-of-swap.html

vm.swappiness is simply a ratio of how costly reclaiming and refaulting anonymous memory is compared to file memory for your hardware and workload

swappiness tips the cost calculation either more towards swapping or more towards dropping filesystem caches when it could go either way. On SSDs these are basically as expensive as each other, so setting vm.swappiness = 100 (full equality) may work well.

The SD has an SSD in it and I have not noticed any adverse behaviour from paging under everyday use, so I'd be disinclined to tweak this setting.
deaddoof Jan 28, 2023 @ 1:47pm 
Originally posted by xep:

swappiness tips the cost calculation either more towards swapping or more towards dropping filesystem caches when it could go either way. On SSDs these are basically as expensive as each other, so setting vm.swappiness = 100 (full equality) may work well.

The SD has an SSD in it and I have not noticed any adverse behaviour from paging under everyday use, so I'd be disinclined to tweak this setting.

Yea, the swappiness should be reduced for emmc steam decks.
xep Jan 31, 2023 @ 7:41pm 
Originally posted by deaddoof:
Originally posted by xep:



The SD has an SSD in it and I have not noticed any adverse behaviour from paging under everyday use, so I'd be disinclined to tweak this setting.

Yea, the swappiness should be reduced for emmc steam decks.

I did not realize the 64 gb SD was eMMC. Having only 64 gb would also explain the 1 gb swap file. I would increase the size (and I have) if I owned a 256 gb or 512 gb SD.
Last edited by xep; Jan 31, 2023 @ 7:45pm
< >
Showing 1-15 of 21 comments
Per page: 1530 50

Date Posted: Sep 9, 2022 @ 5:12am
Posts: 21