Line 4: |
Line 4: |
| When taking a dump of a process tree, it's totally correct to copy contents of all the anonymous private mappings independently and restore them in the same way -- just mmap and put the memory in there. But with this approach we effectively do the described memory duplication and thus increase memory usage by checkpointed and restore application. | | When taking a dump of a process tree, it's totally correct to copy contents of all the anonymous private mappings independently and restore them in the same way -- just mmap and put the memory in there. But with this approach we effectively do the described memory duplication and thus increase memory usage by checkpointed and restore application. |
| | | |
− | To fix this, crtools in version 0.3 and above do special tricks. | + | To fix this, criu in version 0.3 and above do special tricks. |
| | | |
| == How restore works to keep COW intact == | | == How restore works to keep COW intact == |
Line 10: |
Line 10: |
| | | |
| # Which VMAs should be inherited? | | # Which VMAs should be inherited? |
− | # How to avoid intersections with crtools VMAs? | + | # How to avoid intersections with criu VMAs? |
| | | |
| The first question is not resolved completely. Now a VMA is inherited if a parent has a VMA with the same start and end addresses. This covers 99% of cases, but it doesn't work if a VMA was moved. | | The first question is not resolved completely. Now a VMA is inherited if a parent has a VMA with the same start and end addresses. This covers 99% of cases, but it doesn't work if a VMA was moved. |
| | | |
− | The second question is more interesting. Currently crtools reserves continuous space for all private VMAs, then restores all VMAs one by one in this space. Inherited VMAs are moved from a parent space. All VMAs are sorted by start addresses. | + | The second question is more interesting. Currently criu reserves continuous space for all private VMAs, then restores all VMAs one by one in this space. Inherited VMAs are moved from a parent space. All VMAs are sorted by start addresses. |
| | | |
| [[File:cow.png]] | | [[File:cow.png]] |
| | | |
− | In “restorer” all crtools’ VMAs are unmapped and private VMAs are space apart. The complexity of this algorithm is linear. Now it looks simple, but I spent a few hours to find it. | + | In “restorer” all criu’s VMAs are unmapped and private VMAs are space apart. The complexity of this algorithm is linear. Now it looks simple, but I spent a few hours to find it. |
| | | |
| {{Out|“Complexity is easy; simplicity is difficult. -Georgy Shpagin”}} | | {{Out|“Complexity is easy; simplicity is difficult. -Georgy Shpagin”}} |