Title: [185704] trunk/Source/WebKit2
- Revision
- 185704
- Author
- [email protected]
- Date
- 2015-06-18 10:15:50 -0700 (Thu, 18 Jun 2015)
Log Message
~4% Membuster regression after WebKit r185452
https://bugs.webkit.org/show_bug.cgi?id=146112
rdar://problem/21406677
Reviewed by Chris Dumez.
Clear the cache write queue on critical memory pressure. There can be substantial amount of memory there and we
don't know how long writing it out will take. System is often under I/O pressure too in low memory situations.
This also makes sense for process suspension where we send simulated critical memory event.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::lowMemoryHandler):
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::handleMemoryPressureNotification):
* NetworkProcess/cache/NetworkCache.h:
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::clearWriteQueue):
* NetworkProcess/cache/NetworkCacheStorage.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (185703 => 185704)
--- trunk/Source/WebKit2/ChangeLog 2015-06-18 17:13:21 UTC (rev 185703)
+++ trunk/Source/WebKit2/ChangeLog 2015-06-18 17:15:50 UTC (rev 185704)
@@ -1,3 +1,25 @@
+2015-06-18 Antti Koivisto <[email protected]>
+
+ ~4% Membuster regression after WebKit r185452
+ https://bugs.webkit.org/show_bug.cgi?id=146112
+ rdar://problem/21406677
+
+ Reviewed by Chris Dumez.
+
+ Clear the cache write queue on critical memory pressure. There can be substantial amount of memory there and we
+ don't know how long writing it out will take. System is often under I/O pressure too in low memory situations.
+
+ This also makes sense for process suspension where we send simulated critical memory event.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::lowMemoryHandler):
+ * NetworkProcess/cache/NetworkCache.cpp:
+ (WebKit::NetworkCache::Cache::handleMemoryPressureNotification):
+ * NetworkProcess/cache/NetworkCache.h:
+ * NetworkProcess/cache/NetworkCacheStorage.cpp:
+ (WebKit::NetworkCache::Storage::clearWriteQueue):
+ * NetworkProcess/cache/NetworkCacheStorage.h:
+
2015-06-18 Csaba Osztrogonác <[email protected]>
Fix missing braces and deprecated declarations warnings in WebKitNotificationProvider.cpp
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (185703 => 185704)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2015-06-18 17:13:21 UTC (rev 185703)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2015-06-18 17:15:50 UTC (rev 185704)
@@ -176,6 +176,10 @@
void NetworkProcess::lowMemoryHandler(Critical critical)
{
platformLowMemoryHandler(critical);
+#if ENABLE(NETWORK_CACHE)
+ if (NetworkCache::singleton().isEnabled())
+ NetworkCache::singleton().handleMemoryPressureNotification(critical);
+#endif
WTF::releaseFastMallocFreeMemory();
}
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (185703 => 185704)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp 2015-06-18 17:13:21 UTC (rev 185703)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp 2015-06-18 17:15:50 UTC (rev 185704)
@@ -562,6 +562,16 @@
clear(std::chrono::system_clock::time_point::min(), nullptr);
}
+void Cache::handleMemoryPressureNotification(WebCore::Critical critical)
+{
+ if (critical != WebCore::Critical::Yes)
+ return;
+ // There can be substantial amount of memory in the write queue and we don't know how long it will take to write it out.
+ // We may also be about to suspend the process.
+ if (m_storage)
+ m_storage->clearWriteQueue();
+}
+
String Cache::recordsPath() const
{
return m_storage ? m_storage->recordsPath() : String();
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h (185703 => 185704)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h 2015-06-18 17:13:21 UTC (rev 185703)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h 2015-06-18 17:15:50 UTC (rev 185704)
@@ -31,6 +31,7 @@
#include "NetworkCacheEntry.h"
#include "NetworkCacheStorage.h"
#include "ShareableResource.h"
+#include <WebCore/MemoryPressureHandler.h>
#include <WebCore/ResourceResponse.h>
#include <wtf/text/WTFString.h>
@@ -103,6 +104,8 @@
void clear();
void clear(std::chrono::system_clock::time_point modifiedSince, std::function<void ()>&& completionHandler);
+ void handleMemoryPressureNotification(WebCore::Critical);
+
void dumpContentsToFile();
String recordsPath() const;
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp (185703 => 185704)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp 2015-06-18 17:13:21 UTC (rev 185703)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp 2015-06-18 17:15:50 UTC (rev 185704)
@@ -862,6 +862,13 @@
});
}
+void Storage::clearWriteQueue()
+{
+ LOG(NetworkCacheStorage, "(NetworkProcess) clearing write queue");
+
+ m_pendingWriteOperations.clear();
+}
+
void Storage::deleteOldVersions()
{
backgroundIOQueue().dispatch([this] {
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h (185703 => 185704)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h 2015-06-18 17:13:21 UTC (rev 185703)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h 2015-06-18 17:15:50 UTC (rev 185704)
@@ -80,6 +80,8 @@
// Null record signals end.
void traverse(TraverseFlags, TraverseHandler&&);
+ void clearWriteQueue();
+
void setCapacity(size_t);
size_t capacity() const { return m_capacity; }
size_t approximateSize() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes