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.
Deduplication relies on identifying pages that are identical to those in a previous snapshot (the “parent” image).
in_parent FlagThe pagemap-$id.img file describes the virtual memory layout. Each entry (pagemap_entry) can include an in_parent flag:
false: The page’s contents are stored in the current pages-$id.img file.true: The page’s contents are identical to the one in the parent image. CRIU does not write the data to the current pages-$id.img, saving both disk space and I/O time.During a pre-dump, CRIU uses the kernel’s soft-dirty bit to identify which pages have been modified.
in_parent in the current pagemap image and skips dumping its data.--auto-dedup)CRIU provides an advanced --auto-dedup mode that optimizes both the dumping and restoration processes.
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.
A unique and powerful feature of --auto-dedup during restoration is online disk space reclamation:
pages-$id.img files to restore the process’s memory, it uses the fallocate(FALLOC_FL_PUNCH_HOLE) system call on the image files.--prev-images-dir option, allowing CRIU to look back through multiple layers of snapshots.