Line 90: |
Line 90: |
| '''Summary:''' Optimize the pre-dump algorithm to avoid pinning to many memory in RAM | | '''Summary:''' Optimize the pre-dump algorithm to avoid pinning to many memory in RAM |
| | | |
− | Current [[CLI/cmd/pre-dump|pre-dump]] mode suffers from several issues | + | Current [[CLI/cmd/pre-dump|pre-dump]] mode is used to write task memory contents into image |
| + | files w/o stopping the task for too long. It does this by stopping the task, infecting it and |
| + | draining all the memory into a set of pipes. Then the task is cured and resumed and the pipes' |
| + | contents is written into images (maybe a [[page server]]). This approach creates a big stress |
| + | on memory subsystem, as keeping all the memory in pipes creates a lot of unreclaimable memory |
| + | (pages in pipes are not swappable), as well as the number of pipes themselves can be buge (as |
| + | one pipe doesn't store more than a fixed certain amount of data). |
| | | |
− | * It keeps all the memory in pipes, and their number can be huge due to limited one pipe size
| + | We can try to use sys_read_process_vm() syscall to mitigate all of the above. To do this we |
− | * It keeps all the memory in pipes and this memory is unreclaimable for that period
| + | need to allocate a temporary buffer in criu, then walk the target process vm by copying the |
− | * It [[parasite code|stops and infects]] tasks to drain memory from
| + | memory piece-by-piece into it, then flush the data into image (or page server), then repeat. |
− | | |
− | We can try to use sys_read_process_vm() syscall to mitigate all of the above. Benefits: | |
− | | |
− | * No pipes, just copy data into temp buffer and send
| |
− | * Memory is always reclaimable
| |
− | * No infection is needed, just freeze, reset the tracker and proceed
| |
| | | |
| Ideally there should be sys_splice_process_vm() syscall in the kernel, that does the same as | | Ideally there should be sys_splice_process_vm() syscall in the kernel, that does the same as |