[CRIU] Ver3: [PATCH 0/8] GSoC-19 : Optimizing the Pre-dump Algorithm

Andrei Vagin avagin at gmail.com
Fri Oct 4 19:49:39 MSK 2019


1-6 paches have been pushed into the criu-dev. Thanks!


On Thu, Oct 03, 2019 at 07:39:17PM +0530, Abhishek Dubey wrote:
> 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.45
> pre-dump: 0.03
> pre-dump: 0.03
> pre-dump: 0.03
> pre-dump: 0.03
> dump: 0.06
> 
> $ ./test/zdtm.py run --pre 5 -t zdtm/static/maps04 --pre-dump-mode=read -f h
> 
> Read mode -
> pre-dump: 0.49
> pre-dump: 0.03
> pre-dump: 0.03
> pre-dump: 0.03
> pre-dump: 0.03
> dump: 0.06
> 
> Average drop : ~ 8%
> Maximum drop : ~ 8%
> 
> Freeze time:
> ------------
> $ ./test/zdtm.py run --pre 5 -t zdtm/static/maps04 --show-stats -f h
> 
> Splice mode -
> pre-dump: 44251
> pre-dump: 28200
> pre-dump: 28088
> pre-dump: 29959
> pre-dump: 30452
> dump: 57617
> 
> $ ./test/zdtm.py run --pre 5 -t zdtm/static/maps04 --pre-dump-mode=read --show-stats -f h
> 
> Read mode -
> pre-dump: 28613
> pre-dump: 25134
> pre-dump: 25343
> pre-dump: 26140
> pre-dump: 27323
> dump: 58016
> 
> Average reduction : ~18%
> Maximum reduction : ~35%
> 
> 
> Abhishek Dubey (8):
>   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
>   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              |  15 +-
>  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-xfer.c            | 397 ++++++++++++++++++++++++++++++++++++++++++++
>  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 ++++++--
>  17 files changed, 670 insertions(+), 23 deletions(-)
> 
> -- 
> 2.7.4
> 


More information about the CRIU mailing list