5 ms·
While I find the question puzzling, i find the description lacking. The whole explanation of anon maps is redundant, since the behavior of anon maps seems to be
by altmind 6y ago
While I find the question puzzling, i find the description lacking. The whole explanation of anon maps is redundant, since the behavior of anon maps seems to be the same as the behavior of plain memory - its evicted on low memory conditions with LRU behavior and there is no anon maps specifics mentioned.
To recap: swap makes anon memory pages reclaimable, by offloading it to disk. This does not explain anything. Its basically "swap allows anon maps to be swapped"; so what?
>> You need to opportunistically handle the situation yourself before ever thinking about the OOM killer.
Or, just rely on OOM killer, minimal swap(so the application dont agony in low memory conditions) and restart policies. There are no reason to do the kernel work handling memory over-commit.
- lostdog 6y agoAs soon as I figure out how to get the OOM killer to just kill Chrome every time, I might never have to hard reset my system again!
- jwilk 6y agoCuriously, in https://bugs.chromium.org/p/chromium/issues/detail?id=333617 https://bugs.chromium.org/p/chromium/issues/detail?id=333617 people are complaining about the opposite problem: Linux kills a Chromium process, leaving bigger memory hogs roaming around.
- cbsks 6y agoYou are looking for /proc/<pid>/oom_score_adj: https://github.com/torvalds/linux/blob/15a2bc4dbb9cfed1c661a657fcb10798150b7598/Documentation/filesystems/proc.rst#31-procpidoom_adj--procpidoom_score_adj--adjust-the-oom-killer-score https://github.com/torvalds/linux/blob/15a2bc4dbb9cfed1c661a...
- z991 6y agoOn Ubuntu, earlyoom basically does that. It's great. sudo apt install earlyoom
- lostdog 6y agoLooks brilliant, thank you!
- hinoki 6y agoI’ve case you are serious, replace chrome with: #!/bin/bash echo 1000 > /proc/$$/oom_score_adj path_to_real_chrome
- mappu 6y agoWhat's the maintainable way of doing this, that can survive chrome package updates and also handle http URIs opened from other applications?
- steerablesafe 6y agoHow do you typically start chrome? I guess you could just change the .desktop file somewhere in $HOME, system updates don't touch that.
- zbentley 6y agoWon't that just OOM-shield the shell launching chrome and not the chrome process itself? I think you want "exec path_to_real_chrome".