lru: in jump-grow copy loop use peek instead get - #23545
Draft
AskAlexSharov wants to merge 3 commits into
Draft
Conversation
…w copy loop Keys() already walks oldest-first, so the new generation's recency order comes from insertion order. Get additionally moves every entry to the head of the generation being retired -- an unlink plus a relink over three random cache lines per entry, inside the all-stripe fence.
AskAlexSharov
force-pushed
the
alex/cache_grow_peek_37
branch
from
August 25, 2026 05:14
b2a98d8 to
5d470ed
Compare
AskAlexSharov
changed the base branch from
main
to
alex/cache_len_contention_37
August 25, 2026 05:14
peek instead get
AskAlexSharov
force-pushed
the
alex/cache_grow_peek_37
branch
from
August 25, 2026 06:25
5d470ed to
10b4e27
Compare
…to HEAD # Conflicts: # execution/cache/generic_cache.go
Collaborator
Author
|
Merged the reworked base (#23522) in at
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The migration copy in
maybeGrowruns withresizeMuand every put stripe held, so its cost is a stall for all writers.Keys()walks oldest-first, so the new generation's recency order comes from insertion order alone.Getadditionally moves each entry to the head of the generation being retired — an unlink plus a relink over three random cache lines per entry, for nothing.Peekdoes the same lookup without the re-link.Three copy loops:
GenericCache,growLRU,tailLRU.TestGenericCache_GrowCopyMatchesGetBasedCopypins the equivalence on the production path: it drives a jump-grow cache and a fixed-capacity one through the identical insert/read sequence, stops the moment the first real grow fires, then rebuilds the copy the way the code read before this change (Get) into the geometry the grow chose. Keys, order, and values must match. Reversing the copy order or dropping one entry inmaybeGrowboth fail it.Nothing in
execution/cacheorexecution/commitmentreads freelru's ownMetrics()— the only behavioural difference betweenGetandPeek— and no LRU here sets a lifetime, so the sharedfindKeyexpiry path is inert.