Repository navigation
core: a cache trim's first page retirement tracks only retired pages - #3852
Merged
Merged
Conversation
This was referenced Nov 19, 2026
ashhart
force-pushed
the
lead/kv-trim-retired-pages
branch
from
November 19, 2026 22:40
ba9271e to
028e052
Compare
ashhart
added a commit
that referenced
this pull request
Nov 19, 2026
ashhart
added a commit
that referenced
this pull request
Nov 19, 2026
ashhart
added a commit
that referenced
this pull request
Nov 19, 2026
ashhart
added a commit
that referenced
this pull request
Nov 19, 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.
A sliding-window cache trim's first page retirement set up bookkeeping for every page in the pool, so its cost grew with the allocated context rather than the pages actually retired. At 262,144 rows of capacity, 8,192 rows in use and four rows retired, that first retirement asked for 6,291,856 bytes. It now asks for 672, and low and high physical page IDs cost the same.
The retirement table now tracks only retired pages. Reader fences, page reuse and the trim state behave as before: the kept-state SHA-256 transcripts before and after the change match on all three fixtures. The first commit adds the regression test, which fails on main; the second makes it pass.
This measures allocation work on the host, not GPU speed or end-to-end decode throughput.
Checked on this head: the KV pool tests (97, including the new one) and
test-rows-hoston Linux,zig build check-release-paths,zig fmt --check, and the lean check (no new problems). On macOS,test-kv-poolhangs in an existing test on main as well: a thread waits in Zig's debug stack capture. That is tracked separately and not caused by this change.