One thing I obsess a little bit over is the fact that it’s 2026, we pretend that Linux is a serious OS, but we‘re still losing your data on a regular basis.

Out of memory conditions (OOM) are one of our biggest pain points, so I just did a quick experiment with macOS to see how they are handling OOM.

I loaded about 200 memory heavy tabs in Firefox and kept a close look at memory usage.

(1/4)

@verdre you can disable memory overcommitment I think? Never tried that, as I rarely have issues with OOM. But it should give processes an error when they try to malloc, which they then could handle.

@root42 @verdre I have not tested this thoroughly, but I believe that a hefty chunk of Linux's problems with swap thrashing are, at root, caused by its default heuristic that allows 20% of RAM to fill up with data that needs to get written to disk, before it actually starts making write() wait for the disk.

20% of RAM nowadays can easily be in the gigabytes. It takes at least a few seconds to flush all of that to even the fastest SSDs. But it takes only milliseconds to fill it up.

@root42 @verdre Swap thrashing went away forever for me when I started using these sysctl settings:

vm.overcommit_memory = 2
vm.overcommit_ratio = 95
vm.dirty_background_bytes = 16777216
vm.dirty_background_ratio = 0
vm.dirty_bytes = 67108864
vm.dirty_ratio = 0

which means no overcommit, reserve 5% of swap for root, start background writeback at 16 *megabytes* of dirty data and throttle writers at 64 megs

I'd love to work with someone on a proper study of whether this makes sense for everyone

@root42 @verdre I don't tend to have a lot of heavy browser tabs open but I do regularly do big scientific calculations that need swap (for scale, the machine has 32G of RAM and 256G of swap) and it remains usable even when those calculations are grinding away
@zwol I don’t get the browser tabs thing either, rocking some 7-12 year old Macs here running Linux, all with 8G of RAM. But I think the OOM is worse for servers and enterprise applications. If your DB gets killed for example. But then maybe, just maybe, you have other issues. On the desktop this has never hit me. But I don’t push my machines that hard, I guess. My M1 with 16G only goes OOM in macOS due to a Safari bug with patreon.com.