[PATCH v3] Do not release entries that may be stored in memory cache later.

From: Dmitry Kurochkin <dmitry.kurochkin_at_measurement-factory.com>
Date: Fri, 06 Jul 2012 01:57:17 +0400

Since r11969, Squid calls trimMemory() for all entries, including
non-swappable, to release unused MemObjects memory. But it should not
release objects that are or should be stored in local memory cache.
StoreEntry::trimMemory() has a check for IN_MEMORY status for that. But
IN_MEMORY status is set too late in StoreController::handleIdleEntry(),
after trimMemory() marks entry for release:

  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

The patch adds StoreController::keepInLocalMemory() method to determine
if an entry should be kept in memory for later use. It uses different
checks depending on the configuration: shared memory cache checks are
implemented in MemStore::keepInLocalMemory() and local ones are in
StoreController::keepInLocalMemoryCache(). Both methods use
StoreEntry::memoryCachable() for general checks. Shared memory
cache-specific checks are moved from StoreEntry::memoryCachable() to
MemStore::keepInLocalMemory().

Regards,
  Dmitry

Received on Thu Jul 05 2012 - 21:59:52 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 06 2012 - 12:00:03 MDT