feat(snapshot): zero-pause async memory snapshots via userfaultfd write-protect#7
Draft
meAmitPatil wants to merge 11 commits into
Draft
feat(snapshot): zero-pause async memory snapshots via userfaultfd write-protect#7meAmitPatil wants to merge 11 commits into
meAmitPatil wants to merge 11 commits into
Conversation
…c snapshots Signed-off-by: Amit Patil <[email protected]>
…stence Signed-off-by: Amit Patil <[email protected]>
…hase 3) Signed-off-by: Amit Patil <[email protected]>
Signed-off-by: Amit Patil <[email protected]>
…e API endpoint Signed-off-by: Amit Patil <[email protected]>
…cleanup, snapshot_type handling Signed-off-by: Amit Patil <[email protected]>
…tion, pre-allocated vectors Signed-off-by: Amit Patil <[email protected]>
Signed-off-by: Amit Patil <[email protected]>
…or Drop compat Signed-off-by: Amit Patil <[email protected]>
Signed-off-by: Amit Patil <[email protected]>
…wait_timeout status check Signed-off-by: Amit Patil <[email protected]>
meAmitPatil
added a commit
that referenced
this pull request
Mar 27, 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.
Summary
Reduces VM pause time during memory snapshots from 355ms to 7ms for diff snapshots by writing memory to disk in the background while the VM continues running.
How it works
Uses Linux userfaultfd write-protect mode. When an async snapshot is requested:
The VM only pauses long enough to set up page protection (~114ms first time, ~7ms for subsequent diffs). The actual I/O happens in the background.
This is the same technique QEMU uses for live VM snapshots and CRIU uses for live container checkpointing.
Benchmarks (bare metal, 128MB guest)
Testing
E2E test suite validates 7 production scenarios — 20/20 passed on bare metal: