Hi, I use Archlinux and updated systemd-swap to 4.1.0 yesterday. I am unsure if it is working as expected after that update.
The new config got saved as a .pacnew
so I merged the new changes to my old one. This is my current config and this is my old config, if helpful.
systemctl status systemd-swap.service
shows no errors and the the service is active.
● systemd-swap.service - Manage swap spaces on zram, files and partitions.
Loaded: loaded (/usr/lib/systemd/system/systemd-swap.service; enabled; vendor preset: disabled)
Active: active (exited) since Mon 2020-06-08 15:06:05 CEST; 49min ago
Process: 502 ExecStart=/usr/bin/systemd-swap start (code=exited, status=0/SUCCESS)
Main PID: 502 (code=exited, status=0/SUCCESS)
CPU: 290ms
Jun 08 15:06:05 noname systemd[1]: Started Manage swap spaces on zram, files and partitions..
Jun 08 15:06:05 noname systemd-swap[502]: INFO: Load: /etc/systemd/swap.conf
Jun 08 15:06:05 noname systemd-swap[502]: INFO: Zswap: backup current configuration: start
Jun 08 15:06:05 noname systemd-swap[502]: INFO: Zswap: backup current configuration: complete
Jun 08 15:06:05 noname systemd-swap[502]: INFO: Zswap: set new parameters: start
Jun 08 15:06:05 noname systemd-swap[502]: INFO: Zswap: Enable: 1, Comp: zstd, Max pool %: 25, Zpool: z3fold
Jun 08 15:06:05 noname systemd-swap[502]: INFO: Zswap: set new parameters: complete
Jun 08 15:06:06 noname systemd-swap[502]: INFO: swapD: pickup devices from systemd-gpt-auto-generator
Jun 08 15:06:06 noname systemd-swap[502]: INFO: swapD: searching swap devices
free -h
shows 0B
swap and swapon --show
shows nothing at all.
total used free shared buff/cache available
Mem: 7.6Gi 1.8Gi 4.4Gi 269Mi 1.5Gi 5.3Gi
Swap: 0B 0B 0B
I know for a fact systemd-swap worked when I first used it, and I have used to for a while now. Only after this update I just wanted to make sure it still worked, and I am unsure if it does.
Yes it is (probably) working!
New with 4.1 is that a swapfile is only allocated if the ammount of free ram (cached or used or otherwise) is low. You can read more in #105 (although the code has been updated since).
Maybe a short log message after service start, informing the user that swapFC is actually actively monitoring the memory status, would be advisable?
@Jarel1337 Awesome, thanks for responding so fast and letting me know. Sounds good! :smile:
@Jarel1337 actually, I read that PR you linked and I have a question. If the swapfile is _only_ created when RAM is low, do the system not benefit from swap in any other ways?
As far as I know, swap is not only used as "extra RAM"; https://chrisdown.name/2018/01/02/in-defence-of-swap.html
I'd recommend reading https://access.redhat.com/solutions/103833 TL;DR it's working as intended if you're running the default settings (vm.swappiness=60 etc)
Also, you can add a static swap file or partition, not directly managed by systemd-swap, for that purpose.
Most helpful comment
I'd recommend reading https://access.redhat.com/solutions/103833 TL;DR it's working as intended if you're running the default settings (vm.swappiness=60 etc)