[PATCH v2] Do not release entries that may be kept in local memory cache.

From: Dmitry Kurochkin <dmitry.kurochkin_at_measurement-factory.com>
Date: Thu, 05 Jul 2012 21:10:22 +0400

Hi all.

This patch addresses comments by Alex.

Do not release entries that may be kept in local memory cache.

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 another check to StoreEntry::trimMemory() to avoid
trimming of entries that may be cached in memory (local or shared).
We do not know if the entry would really be cached, the final decision
may be complex. So for now we just keep all entries that may be
cached, potentially allowing more entries (and hence using more
memory) than we could.

Regards,
  Dmitry

Received on Thu Jul 05 2012 - 17:12:55 MDT

This archive was generated by hypermail 2.2.0 : Thu Jul 05 2012 - 12:00:03 MDT