[CRIU] How should pre-dump work?

Michael Holzheu holzheu at linux.vnet.ibm.com
Wed Jul 19 12:21:57 MSK 2017


Am Wed, 19 Jul 2017 12:13:25 +0300
schrieb Pavel Emelyanov <xemul at virtuozzo.com>:

> On 07/19/2017 12:19 AM, Mike Rapoprt wrote:
> > 
> > 
> > On July 18, 2017 3:59:40 PM GMT+03:00, Michael Holzheu <holzheu at linux.vnet.ibm.com> wrote:
> >> According to https://criu.org/Iterative_migration I tested the
> >> CRIU pre-dump feature.
> >>
> >> I did the following steps:
> >>
> >> 1) Compile test program that fills 512MB memory
> >> -----------------------------------------------
> >>
> >> ~# cat predump_test.c 
> >> #include <stdio.h>
> >> #include <string.h>
> >> #include <unistd.h>
> >>
> >> /* Define 512 MB buffer */
> >> char buf[(1 << 20) * 512];
> >>
> >> int main(void)
> >> {
> >>        /* Fill buffer */
> >>        memset(buf, 1, sizeof(buf));
> >>        /* Loop */
> >>        while (1) {
> >>                fprintf(stderr, ".");
> >>                sleep(5);
> >>        }
> >>        return 0;
> >> }
> >>
> >> ~# gcc -o predump_test predump_test.c
> >> ~# ./predump_test
> >>
> >> ~# mkdir A B C
> >>
> >> 2) Do 1st pre-dump
> >> ------------------
> >>
> >> # criu pre-dump -t $(pgrep predump_test) --shell-job --images-dir A/
> >>
> >> root at r3545010~# du -h A/*
> >> 4.0K    A/irmap-cache
> >> 8.0K    A/pagemap-27013.img
> >> 513M    A/pages-1.img
> >> 4.0K    A/stats-dump
> >>
> >> We get the expected 513 MB "pages-1.img" file.
> >>
> >> 3) Do 2nd pre-dump
> >> ------------------
> >>
> >> ~# criu pre-dump -t $(pgrep predump_test) --shell-job --images-dir B/
> >> --prev-images-dir ../A
> >>
> >> ~# du -h B/*
> >> 4.0K    B/irmap-cache
> >> 4.0K    B/pagemap-27013.img
> >> 24K     B/pages-1.img
> >> 0       B/parent
> >> 4.0K    B/stats-dump
> >>
> >> As expected the "pages-1.img" file is small.
> >>
> >> 4) Do final dump
> >> ----------------
> >>
> >> ~# criu dump -t $(pgrep predump_test) --shell-job --images-dir C/
> >> --prev-images-dir ../B
> > 
> > I think you also should add --track-mem option
> 
> Yup. The option was missing on the wiki, so I've added one.

Thanks! With the --track-mem option it works as expected.
 
> Michael, you can look at phaul/ subdir of criu-dev branch. It contains the Go code
> doing iterative migration using criu (https://criu.org/P.Haul)

Ok, I will have a look.

Michael



More information about the CRIU mailing list