My Ubuntu 19.10 laptop has 32gb ram and a large swap partition.
I set add vm.swappiness = 0
to /etc/sysctl.conf
so that
$ cat /proc/sys/vm/swappiness
returns 0
Now I expect that swap will not be used until I run out of free memory. However that not the case and for some reason swap starts filling slowly after about 12gb memory is used.
After $ swapoff -a && swapon -a
I get this $ free
output:
total used free shared buff/cache available
Mem: 32522916 12398516 11957400 3751900 8167000 15906172
Swap: 34180092 0 34180092
But then I open one more nasty tab in Chrome and OS starts swapping and freezing even though I still have tons of memory:
total used free shared buff/cache available
Mem: 32522916 12919236 11390868 4063636 8212812 15044060
Swap: 34180092 288000 33892092
Any ideas what is wrong with my configuration and how I could fix it except disabling swap completely?