freenode
Databases & Infrastructure

QEMU gains fast snapshot load via postcopy and userfaultfd

A patch series lets guests resume from large disk snapshots almost immediately by faulting RAM in on demand.

QEMU is poised to cut the wait when restoring a virtual machine from a large snapshot file. Aadeshveer Singh has posted a fifth revision of a migration series that starts the guest as soon as device state is loaded, then brings RAM in lazily instead of reading every page before execution begins.

Today a snapshot restore is fully synchronous: QEMU must pull the entire RAM image into the host before the VM can run. For multi-gigabyte guests that pause can dominate resume time even when the guest only needs a fraction of its memory right away. The new path, branded fast snapshot load, flips that model. It reuses postcopy’s Linux userfaultfd handling so a fault thread serves pages the guest actually touches by reading them straight from the mapped-ram snapshot file. A second eager-load thread walks the rest of RAM in the background so the guest does not stay tied to the fault path forever, and a per-block pending bitmap keeps the two threads from loading the same page twice.

The feature is the combination of the existing postcopy-ram and mapped-ram capabilities, a pairing QEMU previously rejected. Multifd, postcopy-preempt, and vhost-user remain unsupported for now. Singh’s series includes capability checks, a qtest smoke test, and developer documentation, and carries Reviewed-by tags from Peter Xu and Juraj Marcin. Once merged, operators restoring large file-backed snapshots should see a much shorter perceived resume time on hosts with userfaultfd.