Repository navigation
startup: snapshot pool totals and per-reason memory SRV overflow - #3480
Merged
Merged
Conversation
This was referenced Nov 29, 2026
lukaslw-lab
approved these changes
Nov 30, 2026
lukaslw-lab
left a comment
Contributor
There was a problem hiding this comment.
Reviewed d4ac8de4 by reading the diff; not built or run.
Verdict: approve. Counting only, and the totals stay consistent with the chunk state. No MUST.
usedis right becausereuse_upload_chunkis the only place a chunk'susedis reset (upload_reservation.h:188). The release-at-submit path (note_submits,release_upload_chunks_at_submit) changes holds and generations, notused. The recycled reservation is counted once:note_reserved(rounded, recycled), thenreserve_upload_chunkis called without totals.- Ring counters:
finish()runs on exactly the four success paths that used to callnote_reserved. The ring refusal log keeps its own limit of 8, so splitting the old sharedrefused[2]changes nothing. - Census overflow:
more_shape_reasons_hasmemory_srv_reason_countentries, one fewer thanreasons_. That is safe, because the overflow branch is reached only throughmemory_srv_reason_has_shape, which requiresreason < memory_srv_reason_count. - Line lengths:
log()formats into 1536 bytes with 2 kept for CRLF, so the census buffer of 1534 is exactly its maximum. The upload-ring line with the new suffix stays well under it. - NIT:
refusalalready holds the cause at the log call (d3d12_xs_device.cpp:2871), so the line could name it instead of always sayingno unused capacity. That would close the third "Not covered" item.
Tests: startup_snapshot_pool_totals covers tail, second chunk, in-flight and recycle, the shared 8-line limit and the exact summary text. The census check covers overflow per reason and overflow-only periodic reports, and the six mutations show both catch their target. CI did not run them: neither upload_reservation_check nor the census tests are in the pr preset's list, and /O2 was skipped on the PR.
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.
Refs #3477 (items 2 and 4; items 1 and 3 come in a separate PR).
Counting and logging only. Allocation and refusal decisions are unchanged, and both refusal logs are still limited to 8 lines.
Snapshot pool totals (item 2)
reserve_upload_ringcounted reservations, bytes and refusals for the upload ring only. The guest memory input snapshot pool now has its ownSnapshotPoolTotals(upload_reservation.h), updated underallocator_lock.The periodic
x2w-render upload ring:line gains a suffix:used: allocated prefixes of all chunks; a chunk's bytes are subtracted when it is recycled.high-water: peak ofused.reserved,reservations: cumulative.refusals: cumulative, one counter per cause. Every refusal is counted, including those past the 8 logged lines and the zero or oversized requests, which stay silent in the log as before.The ring counters move from the
note_reservedlambda intofinish(), which runs on the same success paths. Thesnapshot pool reservation refusedline keeps its text and its limit of 8.Memory SRV census: calls past the shape table, per reason (item 4)
Once the 128-entry shape table is full, refusals of new shapes only added to one total. They are now also counted per reason, and the report ends with one more line when that total is non-zero:
The per-reason counts sum to the existing
calls past the shape tabletotal. The table size and its key are unchanged. The report line buffer grows from 1024 to 1534 bytes.Tests
Base
c4b8a41b, presetdev:4/4 passed.
startup_snapshot_pool_totals(new,upload_reservation_check --snapshot-pool-totals): tail reservations, a recycled chunk, the 8-line limit shared across causes, and the exact summary text.startup_memory_srv_census(extended): the overflow line, its per-reason counts, and periodic reports when only overflow counts changed.Mutations, each rebuilt and run:
startup_snapshot_pool_totalsusedstartup_snapshot_pool_totalsstartup_snapshot_pool_totalsstartup_memory_srv_censusstartup_memory_srv_censusstartup_memory_srv_censusMerges cleanly with #3469 and #3466 (
git merge-tree).Not covered
reserve_upload_ringat runtime and the periodic line itself are not exercised by a test; the tests coverSnapshotPoolTotalsand the census class.usedcounts chunk prefixes until the chunk is recycled, including chunks whose fences have completed.no unused capacityfor every cause; the cause is only in the counters.