Skip to content

feat(host): a recency hot set for every post-copy source from the kernel's idle-page bits (ADR 0045 C2) - #1612

Merged
nikhilunni merged 1 commit into
mainfrom
feat/postcopy-idle-hot-set
Oct 8, 2026
Merged

nikhilunni merged 1 commit into
mainfrom
feat/postcopy-idle-hot-set

Conversation

@nikhilunni

@nikhilunni nikhilunni commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Gives every post-copy source a recency hot set so the destination drains the pages the guest will touch first (ADR 0045 C2). A live move of a File-mode fresh session shipped an empty hot rider (outcome="no_trace"), so the destination drained 8 GiB in manifest order while agentd faulted its working set on demand. The hot-first drain existed; it had nothing to order by for a source without a UFFD handler.

The change

  • Mark at presetup, read after the blackout. Presetup marks the guest's present, exclusive, anonymous pages idle through /sys/kernel/mm/page_idle/bitmap (compound pages by head, resolved from /proc/kpageflags with a linear extent cache). The capture keeps today's dirty scan only. PFN collection and the idle read run after the export is registered, while the source stays paused, so the blackout is unchanged.
  • Ordering. Accessed pages aggregate per chunk, ordered by count then offset, mapped to chain-manifest hashes, capped at 4096 for the idle tier. The handler-trace tier stays whole and goes first.
  • Delivery. The hint is its own optional export artifact (MigrationItem::HotHint, proto 6, bincode 3) fetched only after state.bin lands, with backoff, never touching the export lease, and stopped by the locally observed drain outcome. The destination drain starts at once in manifest order and reorders the remaining chunks when the hint arrives.
  • Invariant, stated in the module docs: a hint is advisory and no hint path can fail, delay or block a move, a resume, a drain or the blackout. Every delivery, parse and timeout failure is "no hint".
  • HostCapabilities.page_idle is an informational probe (ADR 0068); it never gates placement. Wire version 37.

Tests

PFN word/bit math; shared-page exclusion; aggregation and ordering; hash mapping and caps; compound-extent operation count; trace-first priority; a Linux root test marks and reads a private mapping; a fake-inner test drives the real capture and the real destination poller with hints absent, empty, delayed, malformed and failed, asserting state.bin lands each time; the two-host KVM test asserts move success and hint arrival; the drain reorder is proven deterministically on a fake peer, including hints naming only installed or unsealed chunks.

Validation

just check green (2776 tests); Linux cross clippy for host-agent, uffd-handler, core, protocol and firecracker clean; five Codex adversarial review rounds, final verdict approve on the code and the last test-determinism finding fixed.

Note

🤖 Generated with Claude Code

https://claude.ai/code/session_01UHxL6gj4o8EvxYpgtwEWaM

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped⏩ skipped✅ passedOct 8, 2026, 3:18 AM

@nikhilunni
nikhilunni force-pushed the feat/postcopy-idle-hot-set branch 5 times, most recently from f901310 to f791c53 Compare October 8, 2026 03:12
…nel's idle-page bits (ADR 0045 C2)

A live move of a File-mode fresh session shipped an empty hot rider, so the
destination drained 8 GiB in manifest order while agentd faulted its working
set on demand. The hot-first drain existed; it had nothing to order by for a
source without a UFFD handler.

- Presetup marks the guest's present, exclusive, anonymous pages idle through
  `/sys/kernel/mm/page_idle/bitmap` (compound pages by head, resolved from
  `/proc/kpageflags` with a linear extent cache). The capture keeps today's
  dirty scan only; PFN collection and the idle read run after the export is
  registered, while the source stays paused, so the blackout is unchanged.
- Accessed pages aggregate per chunk, ordered by count then offset, mapped to
  chain-manifest hashes, capped at 4096 for the idle tier; the handler-trace
  tier stays whole and goes first.
- The hint is its own optional export artifact (`MigrationItem::HotHint`),
  fetched by the destination only after `state.bin` lands, with backoff, never
  touching the export lease, and stopped by the locally observed drain. The
  destination drain starts at once in manifest order and reorders the
  remaining chunks when the hint arrives. A hint is advisory: no hint path
  can fail, delay or block a move.
- `HostCapabilities.page_idle` is an informational probe. Wire version 35.

Tests: PFN word/bit math, shared-page exclusion, aggregation and ordering,
hash mapping and caps, compound-extent op count, trace-first priority; a
Linux root test marks and reads a private mapping; a fake-inner test drives
capture and the destination poller with hints absent, empty, delayed,
malformed and failed; the two-host KVM test asserts move success and hint
arrival; the drain reorder is proven deterministically on a fake peer.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UHxL6gj4o8EvxYpgtwEWaM
@nikhilunni
nikhilunni force-pushed the feat/postcopy-idle-hot-set branch from f791c53 to 51264a1 Compare October 8, 2026 03:15
@nikhilunni
nikhilunni merged commit 44938f2 into main Oct 8, 2026
30 checks passed
@nikhilunni
nikhilunni deleted the feat/postcopy-idle-hot-set branch October 8, 2026 04:21
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