Title: [276782] branches/safari-611-branch/Source/WebKit
Revision
276782
Author
[email protected]
Date
2021-04-29 10:12:51 -0700 (Thu, 29 Apr 2021)

Log Message

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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276618 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/WebKit/ChangeLog (276781 => 276782)


--- branches/safari-611-branch/Source/WebKit/ChangeLog	2021-04-29 16:59:25 UTC (rev 276781)
+++ branches/safari-611-branch/Source/WebKit/ChangeLog	2021-04-29 17:12:51 UTC (rev 276782)
@@ -1,3 +1,42 @@
+2021-04-29  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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276618 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-04-26  Ben Nham  <[email protected]>
+
+            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-04-23  Russell Epstein  <[email protected]>
 
         Cherry-pick r276324. rdar://problem/77086404

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


--- branches/safari-611-branch/Source/WebKit/WebProcess/WebProcess.cpp	2021-04-29 16:59:25 UTC (rev 276781)
+++ branches/safari-611-branch/Source/WebKit/WebProcess/WebProcess.cpp	2021-04-29 17:12:51 UTC (rev 276782)
@@ -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