[CRIU] How should pre-dump work?

Pavel Emelyanov xemul at virtuozzo.com
Wed Jul 19 12:13:25 MSK 2017


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.

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)

>> ~# du -h C/*
>> 8.0K    C/cgroup.img
>> 4.0K    C/core-27013.img
>> 4.0K    C/fdinfo-2.img
>> 4.0K    C/files.img
>> 4.0K    C/fs-27013.img
>> 4.0K    C/ids-27013.img
>> 4.0K    C/inventory.img
>> 4.0K    C/mm-27013.img
>> 8.0K    C/pagemap-27013.img
>> 513M    C/pages-1.img
>> 0       C/parent
>> 4.0K    C/pstree.img
>> 4.0K    C/stats-dump
>> 4.0K    C/tty-info.img
>> 4.0K    C/tty.img
>>
>> We get again a 513 MB "pages-1.img" file - why?
>>
>> I get the same results on s390 and on x86.
>>
>> System information
>> ------------------
>> CRIU git version: 1f734612779d076d597dadbbf4ef9256c89d1241 (criu-dev)
>> CRIU version    : Version: 3.2
>> Distro version  : VERSION="16.04.1 LTS (Xenial Xerus)"
>> Kernel version  : Linux r3545010 4.8.0-34-generic #36~16.04.1-Ubuntu
>> SMP Wed Dec 21 19:00:07 UTC 2016 s390x s390x
>>
>> Best Regards,
>> Michael
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
> 



More information about the CRIU mailing list