Skip to content

feat(kvflash): pager serialize/deserialize + critical-chunk pinning#429

Open
dusterbloom wants to merge 3 commits into
Luce-Org:mainfrom
dusterbloom:pr/kvflash-pager-serde-pinning
Open

feat(kvflash): pager serialize/deserialize + critical-chunk pinning#429
dusterbloom wants to merge 3 commits into
Luce-Org:mainfrom
dusterbloom:pr/kvflash-pager-serde-pinning

Conversation

@dusterbloom

@dusterbloom dusterbloom commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

What

Snapshot/restore for the KVFlash pager: serialize() / deserialize() with a
fixed-layout header guard (rejects layout drift), plus critical-chunk pinning so
sink/anchor chunks survive eviction (with a deadlock floor that refuses pins that
would starve the eviction pool).

Shape

  • server/src/common/kvflash_pager.h — header-only addition; backend-agnostic.
  • ~310 LOC. Test: test_kvflash_pager.cpp (serde round-trip + header-mismatch
    guard + pin deadlock guard).

Independent of the placement PR; required by the prefill-snapshot PR.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

Add serialize()/deserialize() to KvFlashPager (snapshot the full resident+paged
KV in logical chunk order; header-validated against layout) and a factored
for_each_segment() helper. serde uses synchronous get/set and adapts to the
pinned void* host_data of the async-DMA path (Luce-Org#408). Add critical-chunk pinning
(pin_range/is_pinned/unpin_all + a best-effort deadlock floor) OR-ed into the
ensure_free_block + reselect protections; empty by default (byte-identical
non-pin path). CPU unit test (no GPU) covers serde round-trip, header-guard
reject, pinning, deadlock guard, reset.
…OB, UAF, atoi-UB, re-prefill fallback, pin_range, gguf type guards)
@dusterbloom dusterbloom force-pushed the pr/kvflash-pager-serde-pinning branch from 5da4d85 to 07f1074 Compare June 24, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant