Changeset 185704 in webkit


Ignore:
Timestamp:
Jun 18, 2015 10:15:50 AM (9 years ago)
Author:
Antti Koivisto
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:
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r185700 r185704  
     12015-06-18  Antti Koivisto  <antti@apple.com>
     2
     3        ~4% Membuster regression after WebKit r185452
     4        https://bugs.webkit.org/show_bug.cgi?id=146112
     5        rdar://problem/21406677
     6
     7        Reviewed by Chris Dumez.
     8
     9        Clear the cache write queue on critical memory pressure. There can be substantial amount of memory there and we
     10        don't know how long writing it out will take. System is often under I/O pressure too in low memory situations.
     11
     12        This also makes sense for process suspension where we send simulated critical memory event.
     13
     14        * NetworkProcess/NetworkProcess.cpp:
     15        (WebKit::NetworkProcess::lowMemoryHandler):
     16        * NetworkProcess/cache/NetworkCache.cpp:
     17        (WebKit::NetworkCache::Cache::handleMemoryPressureNotification):
     18        * NetworkProcess/cache/NetworkCache.h:
     19        * NetworkProcess/cache/NetworkCacheStorage.cpp:
     20        (WebKit::NetworkCache::Storage::clearWriteQueue):
     21        * NetworkProcess/cache/NetworkCacheStorage.h:
     22
    1232015-06-18  Csaba Osztrogonác  <ossy@webkit.org>
    224
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp

    r185605 r185704  
    177177{
    178178    platformLowMemoryHandler(critical);
     179#if ENABLE(NETWORK_CACHE)
     180    if (NetworkCache::singleton().isEnabled())
     181        NetworkCache::singleton().handleMemoryPressureNotification(critical);
     182#endif
    179183    WTF::releaseFastMallocFreeMemory();
    180184}
  • trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp

    r184898 r185704  
    563563}
    564564
     565void Cache::handleMemoryPressureNotification(WebCore::Critical critical)
     566{
     567    if (critical != WebCore::Critical::Yes)
     568        return;
     569    // 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.
     570    // We may also be about to suspend the process.
     571    if (m_storage)
     572        m_storage->clearWriteQueue();
     573}
     574
    565575String Cache::recordsPath() const
    566576{
  • trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h

    r183755 r185704  
    3232#include "NetworkCacheStorage.h"
    3333#include "ShareableResource.h"
     34#include <WebCore/MemoryPressureHandler.h>
    3435#include <WebCore/ResourceResponse.h>
    3536#include <wtf/text/WTFString.h>
     
    104105    void clear(std::chrono::system_clock::time_point modifiedSince, std::function<void ()>&& completionHandler);
    105106
     107    void handleMemoryPressureNotification(WebCore::Critical);
     108
    106109    void dumpContentsToFile();
    107110
  • trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp

    r185513 r185704  
    863863}
    864864
     865void Storage::clearWriteQueue()
     866{
     867    LOG(NetworkCacheStorage, "(NetworkProcess) clearing write queue");
     868
     869    m_pendingWriteOperations.clear();
     870}
     871
    865872void Storage::deleteOldVersions()
    866873{
  • trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h

    r185513 r185704  
    8080    // Null record signals end.
    8181    void traverse(TraverseFlags, TraverseHandler&&);
     82
     83    void clearWriteQueue();
    8284
    8385    void setCapacity(size_t);
Note: See TracChangeset for help on using the changeset viewer.