Re:The Linux kernel's inability to gracefully handle low mem...
by ars on Monday August 05, 2019 @11:51PM
(#20621972)
> I'm not sure how he's getting swap even with swap off
It's not data swap, it's executables. Linux knows it can reread the executable from disk if needed, so it uses those memory pages from other things, and reads them in when needed.
Re:The Linux kernel's inability to gracefully handle low mem...
by mktmkr on Tuesday August 06, 2019 @12:06AM
(#20622031)
This is why one uses mlockall.
Re:The Linux kernel's inability to gracefully handle low mem...
by badamp on Monday August 05, 2019 @11:57PM
(#20621996)
He’s not getting swap. Or in a sense he is... you can still thrash.. the read only pages of the executable and any memory mapped files are still eligible to be paged out. When you get into a memory pressure situation you end up with a handful of executable pages of all the active programs getting faulted-in on every context switch.
Re:The Linux kernel's inability to gracefully handle low mem...
by quotemstr on Tuesday August 06, 2019 @12:11AM
(#20622057)
All memory is conceptually backed by some file. Under memory pressure, the kernel (and this mechanism is the same on any modern kernel) frees memory by writing pages to their backing storage, then discarding them from RAM.
There nothing really special about anonymous memory except that it's backed by swap instead of by a named file on some filesystem. On a system with swap disabled, the backing store is still conceptually swap, but since the swap doesn't exist, pages backed by that imaginary swap can't be evicted from RAM. Pages backed by other backing stores can certainly be evicted from RAM, however, and that's how you "swap" on a swapless system.
Note that executable code is almost all mapped so that it can "swap" in this way.
Then again, this "allocation will never fail" mentality has also lead to applications being written with such an assumption, and when allocations do fail, they crash. (Arguably, that's better than thrashing the rest of the system.) I don't know if the modern browsers will actually stop letting you open new tabs and just give an "out of memory" error instead of crashing, but that's how most Windows programs are usually written --- without the assumption that allocations can never fail, because on Windows, they can.