I have found that when running into an out-of-memory OOM situation, my linux box UI freezes completely for a very long time.
I have setup the magic-sysrq-key then using echo 1 | tee /proc/sys/kernel/sysrq
and encountering a OOM->UI-unresponsive situation was able to press Alt-Sysrq-f
which as dmesg
log showed causes the OOM to terminate/kill a process and by this resolve the OOM situation.
My question is now. Why does linux become unresponsive as much as the GUI froze, however did seem not to trigger the same OOM-Killer, which I did trigger manually via Alt-Sysrq-f
key combination?
Considering that in the OOM "frozen" situation the system is so unresponsive as to not even allow a timely (< 10sec) response to hitting the Ctrl-Alt-F3
(switch to tty3), I would have to assume the kernel must be aware its unresponsiveness, but still did not by itself invoke the Alt-Sysrq-f
OOM-Killer , why?
These are some settings that might have an impact on the described behaviour.
$> mount | grep memory
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
$> cat /sys/fs/cgroup/memory/memory.oom_control
oom_kill_disable 0
under_oom 0
oom_kill 0
which while as I understand states that the memory cgroup does not have OOM neithe activated nor disabled (evidently there must be a good reason to have the OOM_kill active and disabled, or maybe I cannot interpret correctly the output, also the under_oom 0
is somewhat unclear, still)
under_oom
is clearly nothing to be set at all, but onlyindicating if the cgroups is in OOM condition (which it was not when Icat
the oom_control file) – humanityANDpeace Nov 23 '18 at 16:16/usr/src/linux/Documentation/cgroup-v1/memory.txt
and states thatunder_oom
is as I wanted to hint at in the former comment, an indicator if an out-of-memory situation has happened in the memory control group. I think when you say "If set to 0, it means it's not under oom control. Disabled", then this might not really be correct, as indeed it may very well be under out-of-memory control, as theunder_oom
does indicate only if a out-of-memory situation exists, not if control is setup. The documentaiton is not ideal here. – humanityANDpeace Nov 23 '18 at 16:52under_oom
not being anything of a setting/configuration, I fear it does not provide me with insight regarding the question "why is the OOM not triggered automatically"? – humanityANDpeace Nov 23 '18 at 16:54under_oom
would mean wether the oom control is enabled, while indeed we now have figured out it rather states wether a OOM-situation exists. Maybe you can enhance the answer to make it clearer. Thanks for the attempt to point into the right direction :) – humanityANDpeace Nov 23 '18 at 17:04memory.memsw.limit_in_bytes
. This is what "fixed" (cause oom crash immediately rather than hang) it for me. – asr9 Mar 18 '21 at 21:41