4 ms·
I agree with the main gist of the article and a lot of the points, but disagree on a few specifics. 1) mlock isn’t meant to be called on all your memory, just
by ComputerGuru 3y ago
I agree with the main gist of the article and a lot of the points, but disagree on a few specifics.
1) mlock isn’t meant to be called on all your memory, just something that needs it to operate correctly. The situation the author described where the system comes to a halt as memory contents are paged in and out of memory/disk is (subjectively) worse when the only option is for the OOM killer to begin reaping processes everywhere (which would happen if all apps took this advice).
2) the following excerpt is not how any sane modern OS
scheduler works:
> Imagine you have multiple background process running at 100% CPU, then a UI event comes in to the active UI application. The operating system may block for 100ms * N before allowing the UI application to process the event, where N is the number of competing background processes, potentially causing a delayed response to the user that violates the real-time constraint
Modern schedulers calculate priority based off whether the process/thread yielded its remaining execution time in the previous round or was forcibly evicted. Background processes are additionally run at a penalty. The foreground window (on OSes with internal knowledge of such a thing) or terminal owner in the current login session group gets a priority boost. Threads blocked waiting for input events get a massive priority boost.
(But the point stands and it might be a whole lot longer than n * 100ms if drivers or kernel modules are doing stuff.)
- frostiness 3y ago> The situation the author described where the system comes to a halt as memory contents are paged in and out of memory/disk is (subjectively) worse when the only option is for the OOM killer to begin reaping processes everywhere. This one's interesting since your outcome often depends on what hardware you have. On systems with slow IO, i.e. a slow HDD, it's possible for swapping to make a system entirely unusable for minutes, whereas if swap is disabled the OOM killer is able to kick in and solve the issue in less than a minute. That's the difference between being able to keep most of your work open and none of your work open (because the alternative is being forced to reboot).
- ComputerGuru 3y agoBut in the era when spinning rust startup disks were in use everywhere, no app would autosave. I can’t imagine the carnage if MS Word or Excel were just violently killed at the first sign of memory pressure back in the day.
- kaba0 3y agoThe “funny” thing is that I can still regularly hit the “sweet” spot where Linux completely freezes with 8GB of rams (with zram) on a fast SSD.. I think the paging logic still has some assumptions that are only true for hard drives, and that put the system into a frenzy - only REISUB works at that point.