Line 1: |
Line 1: |
− | This article describes how CRIU dumps and restores processes' memory. | + | This article describes how CRIU dumps and restores processes' memory. For memory image file formats, see [[memory dumps]]. |
| | | |
| == Basic C/R == | | == Basic C/R == |
Line 9: |
Line 9: |
| * /proc/pid/smaps file and /proc/pid/map_files/ directory with links are used to determine | | * /proc/pid/smaps file and /proc/pid/map_files/ directory with links are used to determine |
| ** memory areas in use by task | | ** memory areas in use by task |
− | ** file is mapped (if any) | + | ** mapped files (if any) |
| ** shared memory "identifier" to resolve the MAP_SHARED areas | | ** shared memory "identifier" to resolve the MAP_SHARED areas |
| * /proc/pid/pagemap file that reveals important flags | | * /proc/pid/pagemap file that reveals important flags |
Line 17: |
Line 17: |
| * Ptrace SEIZE, used to grab pages from task's VM into a pipe (with vmsplice) | | * Ptrace SEIZE, used to grab pages from task's VM into a pipe (with vmsplice) |
| | | |
− | The last step deserves a more detailed explanation. In order to drain memory from a task, we first generate the bitmap of pages needed to be dumped (using the smaps, map_files and pagemap from proc). Next, we create a set of pipes to put pages into. Then we infect the process with [[parasite code]], which, in turn, gets the pipes and <code>vmsplice</code>s the required pages into it. Finally, we <code>splice</code> the pages from pipes into [[memory dumps|image files]]. | + | The last step deserves a more detailed explanation. In order to drain memory from a task, we first generate the bitmap of pages needed to be dumped (using the smaps, map_files and [[pagemap cache]] filled from proc). Next, we create a set of pipes to put pages into. Then we infect the process with [[parasite code]], which, in turn, gets the pipes and <code>vmsplice</code>s the required pages into it. Finally, we <code>splice</code> the pages from pipes into [[memory dumps|image files]]. |
| | | |
| === Restoring === | | === Restoring === |
Line 95: |
Line 95: |
| | | |
| [[File:Criu-memory-wflow.png]] | | [[File:Criu-memory-wflow.png]] |
| + | |
| + | == See also == |
| + | |
| + | * [[Memory changes tracking]] |
| + | * [[Parasite code]] |
| + | * [[Memory dumps]] |
| + | * [[COW]] |
| + | * [[Shared memory]] |
| + | * [[Postulates]] |
| + | * [[Disk-less migration]] |
| + | * [[Page server]] |
| | | |
| [[Category:Under the hood]] | | [[Category:Under the hood]] |
| [[Category:Memory]] | | [[Category:Memory]] |
| [[Category:Live migration]] | | [[Category:Live migration]] |
| + | [[Category:Editor help needed]] |