0

I am using Parabola Linux (variant of Arch) on a Macbook Pro laptop. I have 8 GB of RAM and 8 GB of swap space set up. As far as I can see, the swap space is enabled and working; however, it seems it is barely being used, even when the physical RAM is heavily loaded. This can be seen in the following screenshot of the gnome system monitor:

enter image description here

The swap seems to be enabled; however only ~3 MB is being used, despite 5.6 GB of RAM being used. I forked this Linux system from one that I have set up on a desktop PC. There, the swap seems to get used much more effectively - it is not uncommon to see 2+ GB in use. I tend to run similar applications on both.

I am concerned that the swap not working effectively may be contributing to the system freezing up occasionally, when I have many programs running at once. I am also concerned that it may be contributing to other issues the system seems to have, such as not being able to hibernate properly (which I understand is supposed to use the swap space on disk).

Does anyone know of any reasons why the swap space might not be being effectively used? Is there anything I can try, to diagnose it? I have seen some older questions with similar issues, but didn't see any concrete answer that seems to help in my situation.

Edit: In response to a request in the comments, here is the output of free -h:

$ free -h
               total        used        free      shared  buff/cache   available
Mem:           7.5Gi       5.4Gi       184Mi        64Mi       1.9Gi       1.8Gi
Swap:          8.0Gi       3.0Mi       8.0Gi

it seems to show similar information to the system monitor. I.e. 72% of RAM is in use, but practically no swap is being used.

I have also checked the 'swappiness' parameter, which gives the following (seems fairly standard):

$ cat /proc/sys/vm/swappiness
60
Time4Tea
  • 2,288
  • 5
  • 23
  • 54
  • 2
    You do not want to use swap. It is orders of magnitude slower than RAM. Swap is only used when active programs use all of RAM. But inactive programs are cached in RAM as you may go back and use them. RAM is only then released from inactive programs, if active program needs space. https://askubuntu.com/questions/184217/why-most-people-recommend-to-reduce-swappiness-to-10-20/184221#184221 – oldfred Nov 19 '21 at 22:47
  • Not sure what System Monitor shows, can you include the output of `free -h`? Maybe https://www.linuxatemyram.com/ applies – Panki Nov 19 '21 at 23:41
  • *"I am concerned that the swap not working effectively may be contributing to the system freezing up occasionally,"* it's more common for the reverse to be true, heavy use of swap can cause the system to freeze while it suddenly pulls 2GB off hard disk. – Philip Couling Nov 20 '21 at 01:46
  • @Panki I have edited the question to add the output of `free -h`. It seems to show similar information to the system monitor. – Time4Tea Nov 22 '21 at 21:31
  • @oldfred sure, I understand that main RAM is faster of course. The swap is supposed to be a fall back, in case the main RAM gets too heavily pressured. Still, it seems it is something that can have a positive benefit if the main RAM gets full, so worth making sure it is working correctly? Is it not also used for hibernation (suspect to disk)? – Time4Tea Nov 22 '21 at 21:33
  • @Time4Tea Swap space is the backing store for anonymous memory - memory that doesn't have a copy already on disk. When you run a process, the binary files that get mapped into the address space already have a backing store should they need to be swapped out: the disk file where they came from. Swap will be reserved (maybe) when anonymous memory pages are created, but the swap space itself won't be used to store that memory temporarily unless an anonymous page needs to be swapped out. Your system just hasn't found the need to swap out anonymous memory yet. – Andrew Henle Nov 22 '21 at 21:37

0 Answers0