Skip to content

Commit 1affb3a

Browse files
committed
doc: document mincore-based diff snapshots
Document that diff snapshots can work even without dirty page tracking, and what the drawbacks of this are (bigger snapshots, no swap support). Signed-off-by: Patrick Roy <[email protected]>
1 parent eff8a41 commit 1affb3a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

docs/snapshotting/snapshot-support.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,20 @@ curl --unix-socket /tmp/firecracker.socket -i \
307307

308308
**Prerequisites**: The microVM is `Paused`.
309309

310-
*Note*: On a fresh microVM, `track_dirty_pages` field should be set to `true`,
311-
when configuring the `/machine-config` resource, while on a snapshot loaded
312-
microVM, `enable_diff_snapshots` from `PUT /snapshot/load`request body, should
313-
be set.
310+
*Note*: Diff snapshots come in two flavor. If `track_dirty_pages` was set to
311+
`true` when configuring the `/machine-config` resource or when restoring from a
312+
snapshot via `/snapshot/load`, Firecracker will use KVM's dirty page log runtime
313+
functionality to ensure the diff snapshot only contains exactly pages that were
314+
written to since boot / snapshot restoration. If `track_dirty_pages` is not
315+
enabled, Firecracker will instead over-approximate the set of pages to include
316+
in the snapshot by instead considering all pages that were _accessed_ during the
317+
VM's lifetime. This potentially results in bigger memory files (although they
318+
are still sparse), but avoids the runtime overhead of dirty page logging.
319+
320+
Without dirty page tracking enabled, Firecracker uses the
321+
[`mincore(2)`][man mincore] syscall to determine which pages to include in the
322+
snapshot. As such, this mode of snapshot taking will only work _if swap is
323+
disabled_, as mincore will not consider pages written to swap to be "in core".
314324

315325
**Effects**:
316326

@@ -626,3 +636,5 @@ the compatibility table reported below:
626636
For example, a snapshot taken on a m6i.metal host running a 5.10 host kernel can
627637
be restored on a different m6i.metal host running a 6.1 host kernel (but not
628638
vice versa), but could not be restored on a c5n.metal host.
639+
640+
[man mincore]: https://man7.org/linux/man-pages/man2/mincore.2.html

0 commit comments

Comments
 (0)