Title: [277059] branches/safari-611-branch/Source/WebKit
Revision
277059
Author
[email protected]
Date
2021-05-05 17:19:05 -0700 (Wed, 05 May 2021)

Log Message

Merge Cherry-pick r276618. rdar://problem/77326484

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/WebKit/ChangeLog (277058 => 277059)


--- branches/safari-611-branch/Source/WebKit/ChangeLog	2021-05-06 00:19:02 UTC (rev 277058)
+++ branches/safari-611-branch/Source/WebKit/ChangeLog	2021-05-06 00:19:05 UTC (rev 277059)
@@ -1,5 +1,24 @@
 2021-05-03  Russell Epstein  <[email protected]>
 
+       Cherry-pick r276618. rdar://problem/77326484
+    
+    Handle warning-level memory notifications more aggressively
+    https://bugs.webkit.org/show_bug.cgi?id=225008
+
+    Reviewed by Chris Dumez.
+
+    We've found that in some workloads, the critical-level memory pressure handler releases
+    significantly more memory than the warning-level memory pressure handler. On Macs, it is
+    likely that the memory pressure coincides with swapping. So when we get even a warning-level
+    notification from the OS, we should err on the side of releasing more memory to help relieve
+    the swapping state. To do this, treat warning level notifications the same as critical level
+    notifications on Mac if the WebProcess is in the background.
+
+    * WebProcess/WebProcess.cpp:
+    (WebKit::WebProcess::initializeWebProcess):
+
+2021-05-03  Russell Epstein  <[email protected]>
+
         Cherry-pick r276852. rdar://problem/77468295
 
     prefers-reduced-motion is not reactive on iOS

Modified: branches/safari-611-branch/Source/WebKit/WebProcess/WebProcess.cpp (277058 => 277059)


--- branches/safari-611-branch/Source/WebKit/WebProcess/WebProcess.cpp	2021-05-06 00:19:02 UTC (rev 277058)
+++ branches/safari-611-branch/Source/WebKit/WebProcess/WebProcess.cpp	2021-05-06 00:19:05 UTC (rev 277059)
@@ -360,6 +360,12 @@
     if (!m_suppressMemoryPressureHandler) {
         auto& memoryPressureHandler = MemoryPressureHandler::singleton();
         memoryPressureHandler.setLowMemoryHandler([this] (Critical critical, Synchronous synchronous) {
+            // If this process contains only non-visible content (e.g. only contains background
+            // tabs), then treat the memory warning as if it was a critical warning to maximize the
+            // amount of memory released for foreground apps to use.
+            if (m_pagesInWindows.isEmpty() && critical == Critical::No)
+                critical = Critical::Yes;
+
 #if PLATFORM(MAC)
             // If this is a process we keep around for performance, kill it on memory pressure instead of trying to free up its memory.
             if (m_processType == ProcessType::CachedWebContent || m_processType == ProcessType::PrewarmedWebContent || areAllPagesSuspended()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to