A Linux Kernel Developers Mailing List the issue of handling out-of-memory situations in Linux:
There is a known issue that has been bothering many people for years and can be reproduced in less than a few minutes on the latest version of the Linux kernel 5.2.6. All kernel parameters are set to their defaults.
Lépések:
- We boot with the parameter 'mem=4G'.
- We disable swap support (sudo swapoff -a).
- We launch any web browser, like Chrome/Chromium or/and Firefox.
- We start opening tabs with websites and watch how the amount of free memory decreases.
As soon as a situation arises where a new tab requires more RAM than is available, the system almost completely freezes. You may even struggle to move the mouse cursor. The hard drive indicator will blink incessantly (for reasons I do not understand). You won't be able to launch new applications or close any that are currently running.
This little crisis can last for minutes or longer. I assume the system shouldn't behave like this. I think something needs to be done to prevent such 'freezes'.
I am almost sure that some sysctl parameters can be changed to avoid such situations, but something tells me that this can be done by default for everyone because non-technical users encountering such a problem will simply give up on using Linux and won't bother searching for solutions on Google.
A On Reddit, some users suggest turning on swap, but this does not solve the problem; it merely postpones it and often exacerbates it. As a possible solution in the future, the newly introduced in the kernel and improved in the kernel PSI (Pressure Stall Information) subsystem may be involved, which allows for analyzing information about the wait time for obtaining various resources (CPU, memory, I/O). This subsystem enables tracking memory shortages at an early stage, identifying the source of problems, and terminating unimportant applications before noticeable effects occur for users.
Forrás: opennet.ru
