The Linux kernel cannot gracefully handle out-of-memory situations

On the Linux kernel developer mailing list raised problem with handling out of free memory situation in Linux:

There is a known issue that has plagued many people over the years and can be reproduced in less than a few minutes on the latest 5.2.6 Linux kernel. All kernel options are set to their default values.

Steps:

  • Boot with "mem=4G" parameter.
  • Turn off swap support (sudo swapoff -a).
  • We launch any web browser, for example, Chrome / Chromium or / and Firefox.
  • We begin to open tabs with sites and see how the amount of free memory decreases.

As soon as a situation arises when a new tab requires more RAM than is available, the system almost completely freezes. You can hardly even move the mouse cursor. The HDD LED will blink non-stop (I don't know why). You won't be able to launch new apps or close current ones.

This little crisis can last for minutes or longer. I guess the system shouldn't behave like this. I think something needs to be done to avoid such "freezes".

I'm pretty sure it's possible to change some sysctl options to avoid this kind of situation, but something tells me it can be done by default for everyone, because non-technical users, faced with such a problem, will simply refuse to use Linux and will not be up to it. in order to search for solutions on Google.

Π’ comments On Reddit, some users suggest turning on swap, but this does not solve the problem, but only pushes it back and often aggravates it. As a possible solution in the future, the 4.20 and improved in the core 5.2 PSI subsystem (Pressure Stall Information), which allows you to analyze information about the waiting time for obtaining various resources (CPU, memory, I / O). This subsystem makes it possible to track the lack of memory at an early stage, determine the source of problems and terminate unimportant applications without causing noticeable effects to the user.

Source: opennet.ru

Add a comment