mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
a203b827db
This patch implements hal::SetProcessPriority() on Linux and leverages it to make it more likely that the parent process and foreground tab survive an OOM situation, letting Linux' OOM killer reap preallocated processes and background tabs first when reclaiming memory. This is achieved by setting the `oom_score_adj` values of said processes such that they will be killed in this order: * Preallocated processes will be the first to go, they don't contain user data and are not visible, so they're a good candidate to free up memory * Background tabs will be killed next, we don't generate crash reports for thoes nor do we inform the user, we just reload the tab, so in most cases one being killed will only be a small annoyance * Background tabs playing video come next, but only if they're not also playing or recording audio * Finally foreground tabs will be killed as a last resort, background tabs playing audio or with an active WebRTC session are also considered to be in the foreground as the user will immediately notice if they crash Note that this patch only implements the low-level plumbing. The process priority manager has not been enabled on Linux yet so that needs to happen before this actually works. Differential Revision: https://phabricator.services.mozilla.com/D153466 |
||
---|---|---|
.. | ||
LinuxProcessPriority.cpp | ||
UPowerClient.cpp |