[webkit-changes] [WebKit/WebKit] 25e995: Slim down WebContent process before suspending

bnham noreply at github.com
Mon Jan 20 09:56:49 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 25e995b03685822cd046ec6e434bed7ca834fc42
      https://github.com/WebKit/WebKit/commit/25e995b03685822cd046ec6e434bed7ca834fc42
  Author: Ben Nham <nham at apple.com>
  Date:   2025-01-20 (Mon, 20 Jan 2025)

  Changed paths:
    M Source/WebKit/WebProcess/WebProcess.cpp
    M Source/WebKit/WebProcess/WebProcess.h

  Log Message:
  -----------
  Slim down WebContent process before suspending
https://bugs.webkit.org/show_bug.cgi?id=286178
rdar://143160263

Reviewed by Per Arne Vollan.

We used to call releaseMemory to slim down WebContent processes before suspending, but stopped doing
so ~1.5 years ago to prevent dropping memory caches for cached WebProcesses (266267 at main), which was
important for the PLT benchmark.

There is some negative impact on not slimming down at suspension time. In particular, for some users
with hundreds of suspended tabs that don't unsuspend for a long time, eventually the system may
detect that it's out of swapfile space and pops up the "your system has run out of memory" dialog,
which is not a good UX.

To help alleviate this, this patch reinstates slimming down processes at suspension time, but with
some throttles:

- We don't slim down cached processes, since we don't want to throw away their memory caches. This
  should be ok since we outright kill cached procesess on memory pressure.

- We only allow a single slim down operation per time that the process becomes visible. This helps
  prevent the pathological case of a process that continually suspends while in the background
  running its low memory handler over and over.

This has no impact on PLT6, and reduces average footprint on our multi-tab stress test by ~25%.

* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::prepareToSuspend):
(WebKit::WebProcess::pageDidEnterWindow):
(WebKit::WebProcess::isProcessBeingCachedForPerformance):
* Source/WebKit/WebProcess/WebProcess.h:

Canonical link: https://commits.webkit.org/289156@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list