gecko-dev/hal
Gabriele Svelto a203b827db Bug 1771712 - Make it more likely for child processes to be killed under OOM conditions compared to the parent process on Linux r=jld
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
2022-08-09 16:05:48 +00:00
..
android Bug 1767346 - Use browsing context activeness rather than renderLayers to determine process priority. r=mccr8,mconley,geckoview-reviewers,agi 2022-05-20 09:14:42 +00:00
cocoa
fallback Bug 1753574 - hal::LockOrientation can return error status. r=smaug,geckoview-reviewers,agi,calu 2022-03-02 03:48:14 +00:00
linux Bug 1771712 - Make it more likely for child processes to be killed under OOM conditions compared to the parent process on Linux r=jld 2022-08-09 16:05:48 +00:00
sandbox Bug 1780788 - Use abstract strings as in-arguments for ipdl. r=nika,necko-reviewers,media-playback-reviewers,alwu,dragana 2022-07-25 20:19:48 +00:00
windows Bug 1710473 - Remove hal::SetProcessPrioritySupported(). r=gsvelto,geckoview-reviewers,aklotz 2021-05-10 19:59:24 +00:00
Hal.cpp Bug 1775154 - Extra cleanup of dom/, extensions/, hal/, netwerk/ and storage/ includes r=necko-reviewers,kershaw 2022-06-22 13:31:25 +00:00
Hal.h Bug 1775154 - Extra cleanup of dom/, extensions/, hal/, netwerk/ and storage/ includes r=necko-reviewers,kershaw 2022-06-22 13:31:25 +00:00
HalBatteryInformation.h
HalIPCUtils.h Bug 1754813 - Make Hal::ScreenOrientation an enum class. r=gsvelto,m_kato,geckoview-reviewers 2022-02-14 07:51:06 +00:00
HalImpl.h
HalInternal.h
HalLog.h
HalNetworkInformation.h
HalSandbox.h
HalScreenConfiguration.h Bug 1754858 - Simplify screen orientation API implementation. r=smaug,m_kato,geckoview-reviewers 2022-02-15 20:22:54 +00:00
HalSensor.h
HalTypes.h
HalWakeLock.cpp Bug 1747138 - Breakdown CPU and GPU time by process type, r=chutten,gsvelto 2022-02-03 20:37:21 +00:00
HalWakeLock.h
HalWakeLockInformation.h
HalWakeLockInternal.h
WindowIdentifier.cpp
WindowIdentifier.h
moz.build Bug 1771712 - Make it more likely for child processes to be killed under OOM conditions compared to the parent process on Linux r=jld 2022-08-09 16:05:48 +00:00