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
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
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
HalImpl.h
HalInternal.h
HalIPCUtils.h
HalLog.h
HalNetworkInformation.h
HalSandbox.h
HalScreenConfiguration.h
HalSensor.h
HalTypes.h
HalWakeLock.cpp
HalWakeLock.h
HalWakeLockInformation.h
HalWakeLockInternal.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
WindowIdentifier.cpp
WindowIdentifier.h