From: Alex Rousskov Date: Thu, 21 Apr 2011 15:13:33 +0000 (-0600) Subject: Disable shared memory cache when not running in SMP mode. X-Git-Tag: take06~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60be8b2dffde38ab531d4fcfbb2f58defe774ca8;p=thirdparty%2Fsquid.git Disable shared memory cache when not running in SMP mode. --- diff --git a/src/MemStore.cc b/src/MemStore.cc index cd12ec04c2..612bc5a78b 100644 --- a/src/MemStore.cc +++ b/src/MemStore.cc @@ -372,7 +372,8 @@ RunnerRegistrationEntry(rrAfterConfig, MemStoreRr); void MemStoreRr::run(const RunnerRegistry &) { - // XXX: restore if (!UsingSmp()) return; + if (!UsingSmp()) + return; if (IamMasterProcess()) MemStore::Init(); @@ -380,7 +381,8 @@ void MemStoreRr::run(const RunnerRegistry &) MemStoreRr::~MemStoreRr() { - // XXX: restore if (!UsingSmp()) return; + if (!UsingSmp()) + return; if (IamMasterProcess()) MemStoreMap::Unlink(ShmLabel); diff --git a/src/ipc/mem/Pages.cc b/src/ipc/mem/Pages.cc index 6ae8ed5901..7f113bee04 100644 --- a/src/ipc/mem/Pages.cc +++ b/src/ipc/mem/Pages.cc @@ -77,7 +77,8 @@ RunnerRegistrationEntry(rrAfterConfig, SharedMemPagesRr); void SharedMemPagesRr::run(const RunnerRegistry &) { - // XXX: restore if (!UsingSmp()) return; + if (!UsingSmp()) + return; // When cache_dirs start using shared memory pages, they would // need to communicate their needs to us somehow. @@ -104,6 +105,9 @@ void SharedMemPagesRr::run(const RunnerRegistry &) SharedMemPagesRr::~SharedMemPagesRr() { + if (!UsingSmp()) + return; + delete ThePagePool; ThePagePool = NULL; if (IamMasterProcess()) diff --git a/src/store.cc b/src/store.cc index 7d7adbcfe0..cf31227c16 100644 --- a/src/store.cc +++ b/src/store.cc @@ -314,7 +314,7 @@ StoreEntry::storeClientType() const * offset 0 in the memory object is the HTTP headers. */ - if (/* XXX: restore: UsingSmp() && */ mem_status == IN_MEMORY) { + if (mem_status == IN_MEMORY && UsingSmp()) { // clients of an object cached in shared memory are memory clients return STORE_MEM_CLIENT; } @@ -1621,8 +1621,7 @@ StoreEntry::setMemStatus(mem_status_t new_status) if (new_status == mem_status) return; - // XXX: restore: if (UsingSmp()) - { + if (UsingSmp()) { assert(new_status != IN_MEMORY); // we do not call this otherwise // This method was designed to update replacement policy, not to // actually purge something from the memory cache (TODO: rename?). diff --git a/src/store_dir.cc b/src/store_dir.cc index 39f92ab9e2..11ff8c6b47 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -92,9 +92,10 @@ STDIRSELECT *storeDirSelectSwapDir = storeDirSelectSwapDirLeastLoad; void StoreController::init() { - // XXX: add: if (UsingSmp()) - memStore = new MemStore; - memStore->init(); + if (UsingSmp() && IamWorkerProcess()) { + memStore = new MemStore; + memStore->init(); + } swapDir->init();