Why use swap files when we could have swap directories? ;-) Sprite had (IMO) a really interesting solution to swap. Each host had a directory, referenced by its host ID under the `/swap` directory, and inside that directory, individual segments of virtual memory would be saved: https://github.com/OSPreservProject/sprite/blob/master/src/k... Sprite overcommited memory like a modern OS, and stored segments individually…
Stop making swap partitions—use swap files instead
191–200 of 257 posts
Re: Stop making swap partitions—use swap files instead
#192Why do I still need swap space at all, be it a swap file or swap partition? I have 64GB of RAM and I don't overprovision it. WHY DO I HAVE TO CONSIDER SWAP in 2026?
Re: Stop making swap partitions—use swap files instead
#193I love how there is no explanation why, or any info why wasting 2GB as partition is any different than as file
Re: Stop making swap partitions—use swap files instead
#194Or be a proper computer user and have a full drive on its own dedicated bus for swap. There is literally no point in time where a full swap drive is less performant or useful than swap directories or swap files (and swap files are a relic of the 90s when a single application would need gobs of virtual memory.) Funny watching someone advocate going back to something that sucked when we have far more performant hardwar…
Re: Stop making swap partitions—use swap files instead
#195Typically I see admins create partitions as basically failure domains - if one fills up it doesn't explode things relying on the others. Wouldn't this be worse in that regard? If you end up accidentally filling up your entire disk, you can no longer swap. Vice versa, if you swap aggressively you could end up filling the disk and then break a running process.
Swapfiles are fixed size just like swap partitions. They do not grow and shrink arbitrarily as you swap more/less.
Re: Stop making swap partitions—use swap files instead
#196> fallocate / chmod / mkswap Why not "mkswap --size ... --file ...", which does these three things and more? For instance, according to the mkswap man page, "[...] sets the nocow attribute for newly created files [...]" which is a detail that seems to be missing from this gist.
I wrote this years ago before LLMs made it easy to validate guesswork. I’ll update! Good call
Re: Stop making swap partitions—use swap files instead
#197Earlier quoted context omitted.
This is called an oomkiller. The kernel has one but it kicks in very late and the kernel prefers to do page trashing instead of killing processes. systemd-oomd should be integrated in systemd, you can configure it to your liking and see if it improves your problem.
I wish there was an easy way to configure it to say "target user processes first, specifically java (or these days python)" as in my experience they are always the culprits. Processes owned by system accounts or root should be the last ones killed.
Re: Stop making swap partitions—use swap files instead
#198Earlier quoted context omitted.
If you care about performance you shouldn't be running from swap period. Swap is just a safety net.
Swap actually helps with performance for the most part. Here's a good summary of what it actually does. https://chrisdown.name/2018/01/02/in-defence-of-swap.html TL;DR that swap shouldn't be seen as "spare RAM", but a mechanism for paging out anonymous pages, which is desirable in many circumstances in avoiding OOM situations and making memory management work better. It paradoxically typically reduces I/O thrashing.
Re: Stop making swap partitions—use swap files instead
#199Earlier quoted context omitted.
If you care about performance you shouldn't be running from swap period. Swap is just a safety net.
I mean, are you saying ‘but more RAM?’ because obviously yes that’s true but not a solution if you already own a laptop, and have you seen ram prices? Also swapping to a fast SSD isn’t like it used to be on spinning discs. I’ve been amazed how responsive Mac neo laptops are and they are swapping all the time.
Re: Stop making swap partitions—use swap files instead
#200[flagged]
You're proudly proclaiming your lack of desire to learn or discuss on a forum meant for those things.
Go to Reddit. That's the right place for you.