Title: [275038] trunk/Source
- Revision
- 275038
- Author
- [email protected]
- Date
- 2021-03-25 09:49:46 -0700 (Thu, 25 Mar 2021)
Log Message
Do not do process pre-warming when the system is under memory pressure
https://bugs.webkit.org/show_bug.cgi?id=223717
<rdar://problem/75810423>
Reviewed by Antti Koivisto.
Source/WebKit:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::prewarmGlobally):
Only do prewarming if we're not under memory pressure as this would make
the situation worse.
Source/WTF:
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::install):
- Listen to the same memory pressure notifications on macOS and iOS. Previously, macOS would not respond to
non-critical memory pressure notifications for example. Also, since macOS would not listen for the notification
that happens when the memory usage goes back to normal, MemoruPressureHandler::isUnderMemoryPressure() would
start returning true after a critical memory pressure notification and it would never go back to false.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (275037 => 275038)
--- trunk/Source/WTF/ChangeLog 2021-03-25 16:33:06 UTC (rev 275037)
+++ trunk/Source/WTF/ChangeLog 2021-03-25 16:49:46 UTC (rev 275038)
@@ -1,3 +1,18 @@
+2021-03-25 Chris Dumez <[email protected]>
+
+ Do not do process pre-warming when the system is under memory pressure
+ https://bugs.webkit.org/show_bug.cgi?id=223717
+ <rdar://problem/75810423>
+
+ Reviewed by Antti Koivisto.
+
+ * wtf/cocoa/MemoryPressureHandlerCocoa.mm:
+ (WTF::MemoryPressureHandler::install):
+ - Listen to the same memory pressure notifications on macOS and iOS. Previously, macOS would not respond to
+ non-critical memory pressure notifications for example. Also, since macOS would not listen for the notification
+ that happens when the memory usage goes back to normal, MemoruPressureHandler::isUnderMemoryPressure() would
+ start returning true after a critical memory pressure notification and it would never go back to false.
+
2021-03-25 Alberto Garcia <[email protected]>
REGRESSION(r271560): [Linux] release assert in Thread::initializePlatformThreading
Modified: trunk/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm (275037 => 275038)
--- trunk/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm 2021-03-25 16:33:06 UTC (rev 275037)
+++ trunk/Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm 2021-03-25 16:49:46 UTC (rev 275038)
@@ -69,16 +69,11 @@
return;
dispatch_async(m_dispatchQueue.get(), ^{
-#if PLATFORM(IOS_FAMILY)
auto memoryStatusFlags = DISPATCH_MEMORYPRESSURE_NORMAL | DISPATCH_MEMORYPRESSURE_WARN | DISPATCH_MEMORYPRESSURE_CRITICAL | DISPATCH_MEMORYPRESSURE_PROC_LIMIT_WARN | DISPATCH_MEMORYPRESSURE_PROC_LIMIT_CRITICAL;
-#else // PLATFORM(MAC)
- auto memoryStatusFlags = DISPATCH_MEMORYPRESSURE_CRITICAL;
-#endif
memoryPressureEventSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, memoryStatusFlags, m_dispatchQueue.get());
dispatch_source_set_event_handler(memoryPressureEventSource, ^{
auto status = dispatch_source_get_data(memoryPressureEventSource);
-#if PLATFORM(IOS_FAMILY)
switch (status) {
// VM pressure events.
case DISPATCH_MEMORYPRESSURE_NORMAL:
@@ -100,9 +95,6 @@
respondToMemoryPressure(Critical::Yes);
break;
}
-#else // PLATFORM(MAC)
- respondToMemoryPressure(Critical::Yes);
-#endif
if (m_shouldLogMemoryMemoryPressureEvents)
WTFLogAlways("Received memory pressure event %lu vm pressure %d", status, isUnderMemoryPressure());
});
Modified: trunk/Source/WebKit/ChangeLog (275037 => 275038)
--- trunk/Source/WebKit/ChangeLog 2021-03-25 16:33:06 UTC (rev 275037)
+++ trunk/Source/WebKit/ChangeLog 2021-03-25 16:49:46 UTC (rev 275038)
@@ -1,3 +1,16 @@
+2021-03-25 Chris Dumez <[email protected]>
+
+ Do not do process pre-warming when the system is under memory pressure
+ https://bugs.webkit.org/show_bug.cgi?id=223717
+ <rdar://problem/75810423>
+
+ Reviewed by Antti Koivisto.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::prewarmGlobally):
+ Only do prewarming if we're not under memory pressure as this would make
+ the situation worse.
+
2021-03-25 Youenn Fablet <[email protected]>
Switch from PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION to filtering interfaces in Network process
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (275037 => 275038)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2021-03-25 16:33:06 UTC (rev 275037)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2021-03-25 16:49:46 UTC (rev 275038)
@@ -610,6 +610,10 @@
void WebProcess::prewarmGlobally()
{
+ if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
+ RELEASE_LOG(PerformanceLogging, "WebProcess::prewarmGlobally: Not prewarming because the system in under memory pressure");
+ return;
+ }
WebCore::ProcessWarming::prewarmGlobally();
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes