AlienTux How much RAM do you have on your machine? If you have 8GB or more, you really don't need SWAP unless you're doing activities like video editing. I have 16GB of RAM on both of my machines, don't have SWAP on either, and I've never ran into problems, even running VirtualBox.

If you have a SSD drive, I believe using SWAP is not good for it because of the constant reading and writing. I could be wrong...do your own research if you do have a SSD.

I can't answer your question about systemd-swap as this is the first time I've heard of it.

    downhill thank you for your reply.

    Actually I currently have 12GB and have multiple times filled it up. I added a 4GB swap file and I'm looking into upgrading to 24GB of RAM. I do some video editing, but mostly I fill up my ram with browser tabs (regardless of browser or addons).

    I was wondering about systemd-swap because it allows the swap file to grow as necessary. Turns out the kernel needs to be modified (it's just actually activating an option actually), but it has been discussed before and apparently hasn't been implemented.

      downhill hahahahahha not a bad idea... but I sometimes do need a few tabs open cuz I'm working on multiple things at the same time... I also use my browser as a kinda "agenda" and "to-do" list. I know there's better ways... Just... the way I'm used to working by now.

      AlienTux

      AlienTux Is it safe to use in Solus?

      Yep. I use it on Solus since Nov 2019.

      ● systemd-swap.service - Manage swap spaces on zram, files and partitions.
           Loaded: loaded (/lib/systemd/system/systemd-swap.service; enabled; vendor preset: enabled)
           Active: active (exited) since Mon 2020-09-28 23:46:21 MSK; 1 day 4h ago
         Main PID: 581 (code=exited, status=0/SUCCESS)
            Tasks: 2 (limit: 4556)
           Memory: 3.9M
              CPU: 1h 14.675s
           CGroup: /system.slice/systemd-swap.service
                   ├─   629 bash /usr/bin/systemd-swap start
                   └─832870 sleep 1s

      But zram and zswap are not working — there is some reaction on forum about zram from dev team.
      Swapfile works fine (currently my swapfile on SSD is 512MB, my laptop have 4GB RAM, I planning to increase swapfile to 1GB), dynamic swap seems not working, but I can be wrong.

        Dentraq oh how did you manage to run it? I tried to install it and it returned an error that the kernel needed an option turned on. Did you have to do something special to get it going?

          AlienTux Hmm, I build it by sudo make install, enable it by sudo systemctl enable --now systemd-swap and use this section to config systemd-swap.
          I don't remember that I have some errors during the installation. I think that error about the disabled kernel option is related with zram and zswap, which is disabled in Solus and not planned to be enabled.

            From ArchWiki:

            Install the systemd-swap package. Uncomment and set swapfc_enabled=1 in the Swap File Chunked section of /etc/systemd/swap.conf. Start/enable the systemd-swap service.

            Dentraq if I may be too bold... would you share your config file?

            I thought that I had to run zram OR zswap. Or is the dynamic swap linked to zswap or zram? What I'd like to do is that systemd-swap change the size of my swap file automagically (I think that's what you mean by dynamic swap right?)

              Dentraq UPD. On my system I don't haveetc/systemd/swap.conf.d/overrides.conf file, all my configuration in /etc/systemd/swap.conf file instead.

              AlienTux

              ################################################################################
              # Defaults are optimized for general usage
              ################################################################################
              
              ################################################################################
              # You can override any settings by files in:
              # /etc/systemd/swap.conf.d/*.conf
              ################################################################################
              
              ################################################################################
              # Zswap
              #
              # Kernel >= 3.11
              # Zswap create compress cache between swap and memory for reduce IO
              # https://www.kernel.org/doc/Documentation/vm/zswap.txt
              
              zswap_enabled=0
              zswap_compressor=lz4      # lzo lz4
              zswap_max_pool_percent=25 # 1-99
              zswap_zpool=zbud          # zbud z3fold
              
              ################################################################################
              # ZRam
              #
              # Kernel >= 3.15
              # Zram compression streams count for additional information see:
              # https://www.kernel.org/doc/Documentation/blockdev/zram.txt
              
              zram_enabled=0
              zram_size=$(( ${RAM_SIZE} / 4 )) # This is 1/4 of ram size by default.
              zram_streams=${NCPU}
              zram_alg=lz4                     # lzo lz4 deflate lz4hc 842 - for Linux 4.8.4
              zram_prio=32767                  # 1 - 32767
              
              ################################################################################
              # Swap File Chunked
              # Allocate swap files dynamically
              # For btrfs fallback to swapfile + loop will be used
              # ex. Min swap size 512M, Max 8*512M
              swapfc_enabled=1
              swapfc_force_use_loop=0     # Force usage of swapfile + loop
              swapfc_frequency=1s         # How often check free swap space
              swapfc_chunk_size=1024M      # Allocate size of swap chunk
              swapfc_max_count=8          # note: 32 is a kernel maximum
              swapfc_free_swap_perc=15    # Add new chunk if free < 15%
                                          # Remove chunk if free > 15+40% & chunk count > 2
              swapfc_path=/var/lib/systemd-swap/swapfc/
              # Only for swapfile + loop
              swapfc_nocow=1              # Disable CoW on swapfile
              swapfc_directio=1           # Use directio for loop dev
              swapfc_force_preallocated=0 # Will preallocate created files
              
              ################################################################################
              # Swap devices
              # Find and auto swapon all available swap devices
              swapd_auto_swapon=1
              swapd_prio=1024

              AlienTux I thought that I had to run zram OR zswap.

              Sorry, you can't do that on Solus.

              AlienTux Or is the dynamic swap linked to zswap or zram?

              Nope, but you can use it together.

              AlienTux What I'd like to do is that systemd-swap change the size of my swap file automagically (I think that's what you mean by dynamic swap right?)

              Yep. But this need to be tested on Solus, I think that is not working properly.

                Dentraq thank you very very much for your comprehensive response! I will check all of this and apply it in my setup 🙂

                Thank you very much!

                  AlienTux It will be very good if you write some report about how dynamic swap working on your setup after testing.