criu

Memory Images Deduplication

During iterative migration, CRIU produces multiple snapshots of a process’s memory. Since most memory pages remain unchanged between iterations, saving every page in every snapshot would result in significant disk space waste and increased migration time. CRIU uses several deduplication techniques to address this.

How Deduplication Works

Deduplication relies on identifying pages that are identical to those in a previous snapshot (the “parent” image).

1. The in_parent Flag

The pagemap-$id.img file describes the virtual memory layout. Each entry (pagemap_entry) can include an in_parent flag:

2. Detection via Soft-Dirty

During a pre-dump, CRIU uses the kernel’s soft-dirty bit to identify which pages have been modified.

Auto-Deduplication (--auto-dedup)

CRIU provides an advanced --auto-dedup mode that optimizes both the dumping and restoration processes.

During Dump

When --auto-dedup is enabled during a dump, CRIU actively manages the relationship between the current and parent image sets to ensure maximum deduplication efficiency. It traverses the previous images to verify which regions can be safely referenced rather than re-dumped.

During Restore (Disk Space Optimization)

A unique and powerful feature of --auto-dedup during restoration is online disk space reclamation:

Implementation Details

See also