[CRIU] [PATCH 0/7] GSoC 19: Optimizing the Pre-dump Algorithm
Abhishek Dubey
dubeyabhishek777 at gmail.com
Wed Aug 21 02:06:55 MSK 2019
This patch series implements optimization of pre-dumping algorithm
as part of GSoC 2019 project.
Previously during pre-dumping, target process needs to be frozen
till all the memory pages are drained into pipes. Then process
unfreeze and pages collected into pipes were written into image
files at end of pre-dump. This approach has two problems. First,
it results in increased frozen time for target process. Second,
pipes induces memory pressure on system, if memory utilization
during pre-dump is nearly equal to system's memory.
In new implementation we try to solve above mentioned two issues
of pre-dumping. Here, the target process needs to be frozen only
to collect memory mappings. Then the process will unfreeze and
continue. Draining of process's pages happens while the process
is running. We use process_vm_readv syscall to drain pages from
process to user-space buffer by using memory mappings collected
while process was frozen. Since draining of pages and process
execution are happening simultaneously, there is possibility
that process might have modified some mappings. This results in
race over memory mapping.
This patch series handles the race over mappings, utilizes
user-space buffer through process_vm_readv syscall to reduce
memory pressure and reduces the frozen time for target process
by allowing it to run as soon as memory mapping collection has
been done. We call this new approach of pre-dumping as "read
mode pre-dump". New CLI option --pre-dump-mode is added for it,
which takes "splice" or "read" as modes. "splice" mode is
traditional parasite way of pre-dumping and is set default.
Evaluation of new approach:
---------------------------
Performance:
------------
$ ./test/zdtm.py run --pre 5 -t zdtm/static/maps04 -f h
Splice mode -
pre-dump: 0.59
pre-dump: 0.06
pre-dump: 0.07
pre-dump: 0.06
pre-dump: 0.06
dump: 0.12
restore: 0.37
$ ./test/zdtm.py run --pre 5 -t zdtm/static/maps04 --pre-dump-mode=read -f h
Read mode -
pre-dump: 0.66
pre-dump: 0.06
pre-dump: 0.06
pre-dump: 0.06
pre-dump: 0.06
dump: 0.12
restore: 0.37
Average drop : ~ 7%
Maximum drop : ~ 20%
Frozen time:
------------
$ ./test/zdtm.py run --pre 5 -t zdtm/transition/maps007 --show-stats -f h
Splice mode -
pre-dump: 109539
pre-dump: 117510
pre-dump: 112030
pre-dump: 113520
pre-dump: 118218
dump: 185512
$ ./test/zdtm.py run --pre 5 -t zdtm/transition/maps007 --pre-dump-mode=read --show-stats -f h
Read mode -
pre-dump: 76995
pre-dump: 81148
pre-dump: 81192
pre-dump: 79184
pre-dump: 81477
dump: 173967
Maximum reduction : ~30%
Abhishek Dubey (7):
Skip adding PROT_READ flag
Skip generating iov for non PROT_READ region
Merging splice and read modes of pre-dump
Drain memory using process_vm_readv syscall
Adding new function cnt_sub
Handle vmsplice failure for read mode pre-dump
Adding --pre-dump-mode option
Documentation/criu.txt | 6 +
criu/config.c | 7 +
criu/cr-dump.c | 13 +-
criu/include/cr_options.h | 6 +
criu/include/mem.h | 2 +-
criu/include/page-xfer.h | 4 +
criu/include/stats.h | 1 +
criu/mem.c | 57 ++++---
criu/page-pipe.c | 4 +
criu/page-xfer.c | 380 ++++++++++++++++++++++++++++++++++++++++++++++
criu/stats.c | 12 ++
test/zdtm.py | 8 +-
12 files changed, 479 insertions(+), 21 deletions(-)
--
2.7.4
More information about the CRIU
mailing list