I agree on those points. Probably a hangover from my Windows days but in that case, having all “cache-type” stuff in its own partition radically reduced fragmentation on the NTFS filesystems … I don’t know if there is any benefit for Linux filesystems (e.g. ext4 which I use) in this regard, though.
It does avoid unexpected filling of the partition a swap file may be on.
Option 1 here, classic swap partition even though my pc never touched it once as far as I can tell xD
I do have only 8gb of ram but my pc it’s not that powerful so I don’t find myself in heavy load situations very often… even when I game I rarely use more than 5gb, so yeah
It is there though, whenever I’ll need it xD
Hi !
I use systemd-swap on all my installs, whatever RAM size.
Even if a partition might be a little faster, not having to care about partition size and not having a permanent fixed space toll pleases me.
In addition, I suspect zswap of being efficient
I also setup swappiness so as to maximize RAM usage.
Systemd-swap insists on zram & zswap being mutually exclusive (zram never improved my systems)
[sum@ordi1 ~]$ sudo swapon -s
Nom de fichier Type Taille Utilisé Priorité
/var/lib/systemd-swap/swapfc/1 file 262140 0 50
[sum@ordi1 ~]$ cat /etc/systemd/swap.conf.d/overrides.conf
swapfc_enabled=1
swapfc_min_count=1
[sum@ordi1 ~]$ cat /proc/sys/vm/swappiness
5
[sum@ordi1 ~]$ cat /proc/sys/vm/vfs_cache_pressure
50
[sum@ordi1 ~]$
Btw, swap is always needed :
I made a french tutorial on systemd-swap setup (easily translatable):
I have always used a swap partition on a hard disk device.
However my main system is old, circa 2008, with just 4GB RAM and a netbook with 2GB RAM neither of which is enough these days and they get slow when swapping to disk, so I would like to consider a faster option, zswap perhaps or systemd-swap which I have not looked into yet and they would need to support sleep and hibernate.
total used free shared buff/cache available
Mem: 15Gi 1,6Gi 12Gi 440Mi 1,8Gi 10Gi
Swap: 7,8Gi 0B 7,8Gi
In /etc/sysctl.d/99-sysctl_tweaks.conf I set vm.swappiness=1 because, having 16 GB of RAM, also when I attempt to saturate the RAM (lot of tabs in browser and also a lot of tabs in SublimeText, lot of applications opened), and so on, I rarely see swap usage; the funny thing is that, when swap is used, it reach at maximum 10MB; I also noticed that swap is used when the valute “buff/cache” reach 13GB.
I don’t use/I have disabled the suspend to disk; I use suspend to ram.
I don’t understand the meaning of this fact: when the swap is used, it reach a ridicolous size (as I’ve said about 10MB), when I expecting that the available RAM should be used instead.
@cscs how do you managed to avoid swap usage? I also tried to set vm.swappiness to 0, but didn’t change this behaviour.
EDIT:
I opened a discussion about, for avoiding to go offtopic here.
Additionally as many have a graphics card installed the motherboard built in graphics processor goes unused (I presume) it seems a pity it could not be utilised in some way, perhaps as swap memory?
Well … theres almost no one that wants to use that.
I mean … maybe if for some reason you have very little RAM, but a beefy GPU you never use … then it could make sense. But thats just about never the case.
Like these quotes from that page:
In the unlikely case that you have very little RAM and a surplus of video RAM, you can use the latter as swap.
A graphics card with GDDR SDRAM or DDR SDRAM may be used as swap by using the MTD subsystem of the kernel. Systems with dedicated graphics memory of 256 MB or greater which also have limited amounts of system memory (DDR SDRAM) may benefit the most from this type of setup.
Warning: Unless your graphics driver can be made to use less ram than is detected, Xorg may crash when you try to use the same section of RAM to store textures as swap. Using a video driver that allows you to override videoram should increase stability.
So … I have yet to encounter anyone actually making use of this.
Now that seems odd. Thats not how your system should work.
Normally if someone has iGPU+dGPU the integrated (weaker) card is used by default, then you call the dedicated (stronger) card when you need it … for example a steam games launch options: prime-run %command%
…some people have too much trouble with such a setup or get confused or simply dont care about the power draw and want their dedicated card on all the time.
This is not usually the preferred method … and without an easy switch in BIOS … it requires some extra work to set.
But maybe in such an instance you could somehow use the ‘disabled’ card as SWAP … though I am not familiar with any such attempt.
This is not usually a safe setting.
But with 16gb … you might never reach it/care.
How did you enable and configure it?
As I showed above I am using a static swapfile.
This is mounted in fstab with a priority of -2.
(If you want some other values… vm.swappiness=10vm.vfs_cache_pressure=50)
And in case anyone is interested in a sort of automated tweaking of sysctl things … heres this:
While a system can work fine this way, you might want to (re-)visit/read the “in defence of swap” article by Chris Down given earlier (see Which swap option do you use? - #28 by nam1962).