]> git.ipfire.org Git - thirdparty/squid.git/commit
Fixed prohibitively slow search for new SMP shm pages (#523)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Mon, 23 Dec 2019 08:54:53 +0000 (08:54 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 23 Dec 2019 08:54:57 +0000 (08:54 +0000)
commitc3408a33f88a3dc3c00f7fb35a3fa96235057191
tree1eb852d04a24232f606d462078b9b075fb7409a5
parent7e851a3e58d6e132ae5ad558bc5e111ce0e90c00
Fixed prohibitively slow search for new SMP shm pages (#523)

The original Ipc::Mem::PageStack algorithm used an optimistic linear
search to locate the next free page. Measurements showed that, in
certain cases, that search could take seconds on busy caches, iterating
over millions of page index items and effectively stalling all workers
while showing 100% CPU utilization.

The new code uses a deterministic stack. It is still lock-free. The spin
loops around stack head pointer updates are expected to quit after at
most few iterations, even with a large number of workers. These loops do
not have ABA update problems. They are not spin locks.
src/ipc/mem/PageStack.cc
src/ipc/mem/PageStack.h