]> git.ipfire.org Git - thirdparty/squid.git/commit
Do not lock an SMP hit twice for the same transaction (#1134)
authorAlex Rousskov <rousskov@measurement-factory.com>
Thu, 15 Sep 2022 07:16:50 +0000 (07:16 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 15 Sep 2022 07:16:59 +0000 (07:16 +0000)
commit778610b524fcbfc615d469a5762a68af13f73c86
tree93b004f3de2be63bd97b3370db58bf9fcbffc9ce
parent6b1d7a0e7870dbffaf1c0ea3822f944ea4b5109b
Do not lock an SMP hit twice for the same transaction (#1134)

Before commit 4310f8b, anchorToCache() (known then as anchorCollapsed())
was only called for not-yet-anchored entries. For anchored entries, we
called updateCollapsed(). In that commit, a new anchorToCache() caller
(i.e. allowSharing() after peek()) started calling anchorToCache() for
all entries, but anchorToCache() code was not updated to skip anchoring
of anchored entries, leading to an extra read lock placed on a peek()ed
hit entry. The extra lock prevented the entry slot from being reused for
other entries when the entry was later purged (i.e. marked for removal),
drastically decreasing hit ratio in some environments.

Fixed anchorToCache() no longer anchors anchored entries. To make sure
we covered all callers/cases, especially in patches, we changed the call
parameters, addressing an old code simplification TODO.
src/MemStore.cc
src/MemStore.h
src/fs/rock/RockSwapDir.cc
src/fs/rock/RockSwapDir.h
src/store/Controlled.h
src/store/Controller.cc
src/store/Controller.h
src/store/Disks.cc
src/store/Disks.h
src/tests/stub_MemStore.cc
src/tests/stub_libstore.cc