Question regarding possible approaches for COW memory dump optimization in CRIU

Shresth Maheshwari <[email protected]> Wed, 25 Mar 2026 06:59:43 +0530
Newsgroups dev.linux.lists.criu
Message-ID <CAL72FQpYODvq4EMjvi_H7VzP3xhi3RKpixq9abMDwovax4C+jw@mail.gmail.com>
Hello Andrei,

My name is Shresth Maheshwari, a third-year ECE student at NIT
Hamirpur (India). I am currently studying the CRIU codebase while
preparing a GSoC proposal for the project “Optimize COW memory
dumping”.

Over the past few days I have been exploring the memory dump pipeline
in mem.c to understand how CRIU determines which pages need to be
dumped. From reading the code, my current understanding is roughly:

• generate_vma_iovs() iterates over VMAs
• generate_iovs() scans pages within each VMA
• should_dump_page() checks pagemap entries to decide whether a page
should be dumped
• selected pages are inserted into the page_pipe and eventually
written to the checkpoint image

While experimenting with simple fork() programs and inspecting pagemap
entries, I observed that parent and child processes often share the
same physical page (same PFN) due to copy-on-write. It seems that
during the dump phase CRIU may dump these pages multiple times since
the algorithm primarily operates on virtual pages.

During restore, restore_priv_vma_content() appears to partially
reconstruct COW relationships by comparing page contents and
identifying identical pages.

Based on this observation, I was considering whether introducing
PFN-based deduplication during the dump phase might be feasible — for
example, detecting when multiple virtual pages refer to the same PFN
and avoiding dumping identical pages more than once.

However, I am unsure whether relying on PFNs would be safe in
practice. In particular I am wondering about potential issues such as
PFN stability during dumping (e.g., page migration), interactions with
file-backed mappings or shared memory, or whether CRIU intentionally
avoids PFN-based logic for correctness reasons.

I would greatly appreciate your thoughts on whether this direction
makes sense, or if there are other approaches that might be more
suitable for optimizing COW memory dumping.

If possible, I would also be grateful if you might be willing to
briefly review my GSoC proposal once I have a draft prepared.

Thank you very much for your time.

Best regards,

Shresth Maheshwari