From 86f83b75c73d9eb2e1f8733a02ce12c58f563530 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 8 Apr 2023 17:13:18 -0600 Subject: containers: ARCache: Don't count "nested" uses as "frequent" uses This is a modification to how "pinning" is implemented, that should hopefully result in better performance of the ARC policy. --- lib/containers/arcache.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/containers') diff --git a/lib/containers/arcache.go b/lib/containers/arcache.go index 29ec030..deb80f0 100644 --- a/lib/containers/arcache.go +++ b/lib/containers/arcache.go @@ -504,9 +504,12 @@ func (c *arCache[K, V]) Acquire(ctx context.Context, k K) *V { switch { case c.liveByName[k] != nil: // cache-hit entry = c.liveByName[k] - if entry.List != &c.frequentPinned { - // Move to frequentPinned (unless it's already - // there; in which case, don't bother). + // Move to frequentPinned, unless: + // + // - it's already there; in which case, don't bother + // - it's in recentPinned; don't count "nested" uses + // as "frequent" uses. + if entry.List != &c.frequentPinned && entry.List != &c.recentPinned { entry.List.Delete(entry) c.frequentPinned.Store(entry) } -- cgit v1.2.3-2-g168b