@karolherbst @elly aren't they less efficient?
(Also, with RAM going for scarcity again, looks like swap is going to have a comeback.)
@elly @karolherbst You can hibernate to swap files, no need for partitions.
Heck, systemd can even allocate swap as needed.
My take: don't use swap partitions.
@karolherbst @elly Wait until I use it for preemption in CI jobs 🤣
Hopefully coming to your favourite gitlab instance this year!
@karolherbst IIUC (big caveat) using a swapfile instead of a dedicated partition doesn't work for hibernation due to a combination of issues with grub, kernel_lockdown security, and / or allocating a swapfile on CoW filesystems like Btrfs
but if you don't need hibernation, you can simplify your setup considerably. that's just not (yet?) the default
@karolherbst to answer the question with a question: what's the math for when swapfiles are effective? There seems to be a ratio of disk read and write speeds vs total RAM (or maybe total overcommit?) and disk latency.
Back in the day with only a few MB RAM, the higher relative disk speeds seemed to make the offset worthwhile. Maybe it's worth tuning in an age where RAM prices are through the roof.
@bakuninboys Well swap partitions kinda prevent a big swap, because nobody wants to waste 16GB on swap that they are barely using.
But if it's more dynamic, then the OS could allocate more swap if it wants to page out more things if they are never used.
And a file cache is often a better use of RAM than memory that's never used. So it could in theory even lower IO operations if more storage is made available as swap.
@karolherbst ah you're talking about swap partition vs swap file. Yeah I'm guessing the fs ops would be CPU bound so in the modern world you'd immediately make the trade.
I wonder if there is some specific handling for swap files needed by the fs. Eg: you update the swap file and the is driver just keeps the COW operation / journal in memory, defeating the purpose, or at least confounding the operation.