[CRIU] Ver2: [PATCH 0/9] GSoC-19 : Optimizing the Pre-dump Algorithm

Abhishek Dubey dubeyabhishek777 at gmail.com
Sun Sep 22 07:24:49 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 (9):
  Adding --pre-dump-mode option
  Handling iov generation for non-PROT_READ regions
  Skip adding PROT_READ to non-PROT_READ mappings
  Adding cnt_sub for stats manipulation
  Handle vmsplice failure for read mode pre-dump
  read mode pre-dump implementation
  Refactor time accounting macros
  Added --mix-pre-dump option for zdtm suite
  Adding travis test for --mix-pre-dump

 Documentation/criu.txt      |  10 ++
 criu/config.c               |  10 ++
 criu/cr-dump.c              |  14 +-
 criu/cr-service.c           |  13 ++
 criu/crtools.c              |   2 +
 criu/include/cr_options.h   |   7 +
 criu/include/page-xfer.h    |   4 +
 criu/include/stats.h        |   1 +
 criu/mem.c                  | 123 ++++++++++++--
 criu/page-pipe.c            |  16 ++
 criu/page-xfer.c            | 389 ++++++++++++++++++++++++++++++++++++++++++++
 criu/stats.c                |  12 ++
 images/inventory.proto      |   1 +
 images/rpc.proto            |   6 +
 lib/c/criu.c                |  15 ++
 lib/c/criu.h                |   7 +
 scripts/travis/travis-tests |   2 +
 test/zdtm.py                |  68 ++++++--
 18 files changed, 677 insertions(+), 23 deletions(-)

-- 
2.7.4



More information about the CRIU mailing list