lru: fastpath before taking resizeMu in maybeGrow - #23546
Closed
AskAlexSharov wants to merge 3 commits into
Closed
Conversation
AskAlexSharov
force-pushed
the
alex/cache_grow_latch_37
branch
from
August 25, 2026 04:48
d6aaae4 to
724ce74
Compare
AskAlexSharov
force-pushed
the
alex/cache_grow_latch_37
branch
from
August 25, 2026 05:01
724ce74 to
b2a98d8
Compare
AskAlexSharov
force-pushed
the
alex/cache_grow_peek_37
branch
from
August 25, 2026 05:14
b2a98d8 to
5d470ed
Compare
AskAlexSharov
force-pushed
the
alex/cache_grow_latch_37
branch
from
August 25, 2026 05:14
105d505 to
75930e9
Compare
…fundable grow before taking resizeMu A full LRU never drops back below curCap, so once the envelope cannot fund the next step the fast-path gate stays armed and every later write re-enters maybeGrow and serialises on the single resizeMu. tailLRU also pays an all-shard Len() ahead of it. Gate on CanReserve instead, which needs no per-cache state and picks up bytes a later Close returns on its own.
AskAlexSharov
force-pushed
the
alex/cache_grow_peek_37
branch
from
August 25, 2026 06:25
5d470ed to
10b4e27
Compare
AskAlexSharov
force-pushed
the
alex/cache_grow_latch_37
branch
from
August 25, 2026 06:25
0c5cfcc to
717ae7c
Compare
This was referenced Aug 25, 2026
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.
Stacked on #23545.
A full LRU never drops back below
curCap. So once the envelope cannot fund the next grow step, the fast-path gate stays armed forever and every later write re-entersmaybeGrow, takes the one globalresizeMu, fails the sameReserveand returns — a process-wide serialisation point on the cache write path.tailLRU.Addis worse: it pays an all-shardLen()ahead of that call.Gate on
Budget.CanReserveinstead: one atomic load, no per-cache state, and bytes a laterClose/Clearreturns are picked up on the next write with nothing to reset.state_cache.goalready documents "that cache stops growing" — now that is what the code does.Same gate in
GenericCache.putStriped,growLRU.Add,tailLRU.Add.Not what the current
stage_execmutex profile shows (those events are funded grows); this is the cliff behind them.