]> git.ipfire.org Git - thirdparty/squid.git/commit
Restore memory caching ability lost since r11969.
authorDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Fri, 13 Jul 2012 14:33:19 +0000 (08:33 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 13 Jul 2012 14:33:19 +0000 (08:33 -0600)
commit96a7de8859853c795b08f0ca7cab92352b553d94
tree7fa7c81e3b8912d8360ce876b2e65bcd0a78ac7c
parent23d23d7adc1b01529b7f374ebb48e35cd3748c4a
Restore memory caching ability lost since r11969.
Honor maximum_object_size_in_memory for non-shared memory cache.

Since r11969, Squid calls trimMemory() for all entries to release unused
MemObjects memory. Unfortunately, that revision also started trimming objects
that could have been stored in memory cache later. Trimmed objects are no
longer eligible for memory caching.

It is possible that IN_MEMORY check in StoreEntry::trimMemory() was preventing
excessive trimming in the past, but after SMP changes, IN_MEMORY flag is set
only after the object is committed to a memory cache in
StoreController::handleIdleEntry(), so we cannot rely on it. For example:

  clientReplyContext::removeStoreReference()

    storeUnregister()
      StoreEntry::swapOut()
        StoreEntry::trimMemory()
          StoreEntry::releaseRequest()

    StoreEntry::unlock()
      StoreController::handleIdleEntry() // never get here because entry is
        set IN_MEMORY status             // already marked for release

This change adds StoreController::keepForLocalMemoryCache() and
MemStore::keepInLocalMemory() methods to check if an entry could be stored in
a memory cache (and, hence, should not be trimmed). The store-related part of
the trimming logic has been moved from StoreEntry::trimMemory() to
StoreController::maybeTrimMemory(). StoreEntry code now focuses on checks that
are not specific to any memory cache settings or admission policies.

These changes may resulted in Squid honoring maximum_object_size_in_memory for
non-shared memory cache. We may have been ignoring that option for non-shared
memory caches since SMP changes because the check for it was specific to a
shared memory cache.
src/MemStore.cc
src/MemStore.h
src/Store.h
src/SwapDir.h
src/store.cc
src/store_dir.cc
src/store_swapout.cc