Re:In defence of swap: common misconceptions
by lostdog on Tuesday June 09, 2020 @12:48AM
(#23463744)
As 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!
You are looking for /proc/<pid>/oom_score_adj:
https://github.com/torvalds/linux/blob/15a2bc4dbb9cfed1c661a...
Curiously, in 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.
On Ubuntu, earlyoom basically does that. It's great.
sudo apt install earlyoom
Re:In defence of swap: common misconceptions
by lostdog on Tuesday June 09, 2020 @11:04PM
(#23473476)
Looks brilliant, thank you!
Re:In defence of swap: common misconceptions
by hinoki on Tuesday June 09, 2020 @02:45AM
(#23464326)
I’ve case you are serious, replace chrome with:
#!/bin/bash
echo 1000 > /proc/$$/oom_score_adj
path_to_real_chromeWhat's the maintainable way of doing this, that can survive chrome package updates and also handle http URIs opened from other applications?
Re:In defence of swap: common misconceptions
by steerablesafe on Tuesday June 09, 2020 @03:55AM
(#23464666)
How do you typically start chrome? I guess you could just change the .desktop file somewhere in $HOME, system updates don't touch that.
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.