I am using Kinoite and the swap is 8gb. How do I increase it? Thanks.
Have a look at man zram-generator.conf
on how to configure the zram swap.
What happened that made you think swap was too small?
Thanks @barryascott I will take a look at that.
When I installed Kinoite I followed the defaults for everything as I wasn’t confident changing values. I have 32gb of ram.
ian@192:~$ swapon --show
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 8G 4.4G 100
ian@192:~$ free
total used free shared buff/cache available
Mem: 32533496 23338400 5256224 9390712 13864296 9195096
Swap: 8388604 4628224 3760380
ian@192:~$
I found this page Is there anyway to increase the swap partition size? which says that zram0 isn’t actually swap but is ram, this is confusing me.
swapping to disk is too slow to be practical on a desktop these days.
It has been found that swapping into compressed RAM pages is a good solution that avoid the issues with using slow disk, even SSDs are slow compared to RAM.
See this change proposal for more background: Changes/SwapOnZRAM - Fedora Project Wiki
If you need more swap then you can change the defaults of using 8GiB of ram as documented in man zram-generator.conf
.
What is your work flow that will need the extra swap?
Thanks again @barryascott really helpful.
What is your work flow that will need the extra swap?
The aim to stop my machine is 100% CPU and becoming unresponsive and needing restarting when all 32gb of is ram used and all 8gb of swap. When I first posted I didn’t realise it wasn’t swapping to disk like in the olden days.
It isn’t to increase swap per ce.
Tasks: 492 total, 1 running, 490 sleeping, 0 stopped, 1 zombie
%Cpu(s): 3.4 us, 1.5 sy, 0.0 ni, 94.6 id, 0.0 wa, 0.4 hi, 0.2 si, 0.0 st
MiB Mem : 31771.0 total, 6000.1 free, 19830.7 used, 13526.7 buff/cache
MiB Swap: 8192.0 total, 5033.2 free, 3158.8 used. 11940.2 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2387 ian -2 0 3751308 357352 281124 S 32.6 1.1 103:54.54 kwin_wayland
33614 ian 20 0 13.1g 973256 377768 S 12.0 3.0 266:38.61 firefox-bin
50568 ian 20 0 32.9g 138900 59268 S 11.0 0.4 281:12.70 slack
34393 ian 20 0 4696240 1.5g 150764 S 7.0 4.8 8,12 Isolated Web Co
50636 ian 20 0 1137.8g 701664 129848 S 7.0 2.2 238:30.25 slack
53264 ian 20 0 20.1g 3.5g 340884 S 5.3 11.2 112:52.98 java
120245 ian 20 0 2152052 161408 137220 S 5.3 0.5 0:01.78 konsole
So, is the 8gb of swap using 8gb of my 32ram?
Perhaps there is something else going on causing my machine to use so much memory. I didn’t have this experience with KDE Neon.
Only if you need to swap. Then only the RAM necessary is used.
You can see the amount used a couple of ways.
This is from a VM with 4GiB of RAM allocated to it.
$ free -h
total used free shared buff/cache available
Mem: 3.8Gi 1.5Gi 154Mi 80Mi 2.4Gi 2.3Gi
Swap: 3.8Gi 3.2Mi 3.8Gi
$ swapon
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 3.8G 4M 100
You can see only a few MiB are in use.
Thanks - this is new world to me. I need to read up more on it.
This is the current state of my machine.
ian@192:~$ free -h
total used free shared buff/cache available
Mem: 31Gi 19Gi 6.0Gi 6.9Gi 13Gi 11Gi
Swap: 8.0Gi 3.1Gi 4.9Gi
ian@192:~$ swapon
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 8G 3.1G 100
ian@192:~$
FYI you can see how the kernel is using memory in the /proc/meminfo
file.
For a specific process you can look at files in /proc/<PID>
, for example /proc/<PID>/status
lists the amount of swap a process is using.
For java processes, pay attention to the setting for maximum heap size. The java process will scan through the heap at regular intervals for garbage collection, and if the heap can’t fit entirely in physical ram space, you get serious thrashing from and to the swap. More swap will not help in this case.