Not sure why that is, but I have 32 GB of RAM and I would like my system to utilize it as much as possible, but as you can see in the screenshot, the system is only using 5.66 GB of the physical RAM, but swap is still being used in a high number. Is this normal? Should I lower the swappiness to lower than 10? Should I let it be? Thanks
Here is the screenshot

  • sgtlion [any]@hexbear.net
    link
    fedilink
    English
    arrow-up
    10
    ·
    edit-2
    22 days ago

    This is normal. This is a topic with a lot of complexities if you drill down into the details and history, but the tl;dr is certain system processes and other programs will preferably write data to swap because it’s so infrequently needed, and avoids massive slowdown if swap is needed, eg RAM filling, hibernation.

    If you’re absolutely sure you’ll never exceed 32gb of RAM usage, you can turn the swap off. But you’re unlikely to notice a performance boost, Linux does (largely) know what it’s doing, moreso than you or I.

    The TankieTanuki link is a good place to start to learn more if you really want to tweak it.

    • kevincox@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      22 days ago

      To put it another way you want to be using all of your RAM and swap. It becomes a problem if you are frequently reading from Swap. (Writing isn’t usually as much of an issue as they may be proactive writes in case more memory needs to be filled up).

      Basically a perfect OS would use RAM + Swap such that the least disk reads need to be issued. This can mean swapping out some idle anonymous memory so that the space can be used as disk cache for some hotter data.

      In this screenshot the OS decided that it was better to swap out 3GiB of something to use that space for the disk cache (“Cached” ). It is likely right about this decision (but is not always).

      3 GiB does seem a bit high. But if you have lots of processes running that are using memory but are mostly idle it could definitely happen. For example in my case I often have lots of Language Servers running in my IDE, but many of them are for projects that I am not actively looking at so they are just waiting for something to happen. These often take lots of memory and it may make sense to swap these out until they are used again.