<div dir="ltr">Sorry missed mailing list.<br clear="all"><div><div dir="ltr"><br>Best Regards, Tikhomirov Pavel.</div></div>
<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Pavel Tikhomirov</b> <span dir="ltr"><<a href="mailto:snorcht@gmail.com">snorcht@gmail.com</a>></span><br>
Date: 2014-04-01 17:36 GMT+04:00<br>Subject: Re: [CRIU] [PATCH] zdtm: add test maps008 for dedup on unmap vma<br>To: Andrew Vagin <<a href="mailto:avagin@parallels.com">avagin@parallels.com</a>><br><br><br><div dir="ltr">
<div class="gmail_extra"><br><div class="gmail_quote">2014-04-01 17:18 GMT+04:00 Andrew Vagin <span dir="ltr"><<a href="mailto:avagin@parallels.com" target="_blank">avagin@parallels.com</a>></span>:<div class=""><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Tue, Apr 01, 2014 at 03:10:40PM +0400, Tikhomirov Pavel wrote:<br>
> this test mmaps 512M area of memory, than sleep to be dumped,<br>
> than it munmaps 128 odd areas of size 2M of all 256 such areas<br>
> and in second dump process will have only 256M of memory<br>
<br>
</div>Why do we need so big slice of memory? What is a difference between 64<br>
Mb and 512 Mb for this test? Will it catch more bugs with 512Mb?</blockquote><div><br></div></div><div>For this test it doesn't matter, yes, we can do even less than 64Mb.</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>
><br>
> if --auto-dedup option is on, all images in the end must be<br>
> of size 0<br>
><br>
> use:<br>
> sudo bash test/zdtm.sh -P -i 2 --auto-dedup transition/maps008<br>
><br>
> to work need "[PATCH] dedup: add dedup on unmap vma, into<br>
> auto-dedup and dedup"<br>
><br>
> Signed-off-by: Tikhomirov Pavel <<a href="mailto:snorcht@gmail.com" target="_blank">snorcht@gmail.com</a>><br>
> ---<br>
> test/zdtm.sh | 1 +<br>
> test/zdtm/live/transition/Makefile | 1 +<br>
> test/zdtm/live/transition/maps008.c | 65 +++++++++++++++++++++++++++++++++++++<br>
> 3 files changed, 67 insertions(+)<br>
> create mode 100644 test/zdtm/live/transition/maps008.c<br>
><br>
> diff --git a/test/zdtm.sh b/test/zdtm.sh<br>
> index d7f8fca..e4ed770 100755<br>
> --- a/test/zdtm.sh<br>
> +++ b/test/zdtm.sh<br>
> @@ -103,6 +103,7 @@ static/chroot<br>
> static/chroot-file<br>
> static/rtc<br>
> transition/maps007<br>
> +transition/maps008<br>
> "<br>
> # Duplicate list with ns/ prefix<br>
> TEST_LIST=$TEST_LIST$(echo $TEST_LIST | tr ' ' '\n' | sed 's#^#ns/#')<br>
> diff --git a/test/zdtm/live/transition/Makefile b/test/zdtm/live/transition/Makefile<br>
> index a4d0127..c1f7a7a 100644<br>
> --- a/test/zdtm/live/transition/Makefile<br>
> +++ b/test/zdtm/live/transition/Makefile<br>
> @@ -13,6 +13,7 @@ TST_NOFILE = \<br>
> fork2 \<br>
> thread-bomb \<br>
> maps007 \<br>
> + maps008 \<br>
><br>
> TST_FILE = \<br>
> file_read \<br>
> diff --git a/test/zdtm/live/transition/maps008.c b/test/zdtm/live/transition/maps008.c<br>
> new file mode 100644<br>
> index 0000000..04054be<br>
> --- /dev/null<br>
> +++ b/test/zdtm/live/transition/maps008.c<br>
> @@ -0,0 +1,65 @@<br>
> +#include <unistd.h><br>
> +#include <sys/mman.h><br>
> +<br>
> +#include "zdtmtst.h"<br>
> +<br>
> +#define MEM_SIZE (1 << 29)<br>
> +#define PAGE_SIZE 4096<br>
> +<br>
> +const char *test_doc = "create big mapping and unmap odd blocks of size 2M";<br>
> +<br>
> +int main(int argc, char **argv)<br>
> +{<br>
> + void *start, *p;<br>
> + unsigned long long count = 0;<br>
> + unsigned long long i;<br>
> +<br>
> + test_init(argc, argv);<br>
> +<br>
> + /*<br>
> + * allocate workspace<br>
> + */<br>
> + start = mmap(NULL, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);<br>
> + if (start == MAP_FAILED)<br>
> + return -1;<br>
> +<br>
> + test_msg("%p-%p\n", start, start + MEM_SIZE);<br>
> +<br>
> + /*<br>
> + * dirty pages to ensure allocation<br>
> + */<br>
> + for (i = 0; i < MEM_SIZE/PAGE_SIZE; i++) {<br>
> + char *t = start + i * PAGE_SIZE;<br>
> + t[0] = 'o';<br>
> + }<br>
> +<br>
> + test_daemon();<br>
> +<br>
> + /*<br>
> + * Sleep to make 1-st dump get all workspace<br>
> + */<br>
> + sleep(1);<br>
<br>
</div></div>test_waitsig()</blockquote><div><br></div></div></div><div>Oh, now I understand. Thanks!</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br></blockquote>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> +<br>
> + while (test_go()) {<br>
<br>
I don't understand this loop. Pls explain.<br></blockquote><div><br></div></div><div>OK. and may be i need to simplify it.</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div> </div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
> + int ret;<br>
> + unsigned long size = 512 * PAGE_SIZE;<br>
> +<br>
> + if (count * size >= MEM_SIZE)<br>
> + break;<br></div></blockquote><div><br></div></div><div>count til the end of memory, than break.</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
> + p = start + ((count) * size);<br>
> + count+=2;<br></div></blockquote><div><br></div></div><div>counts step is 2, because I want unmap odd blocks: 1-st,3-rd, etc.</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
> +<br>
> + /*<br>
> + * unmap every odd block of size 2M<br>
> + */<br>
> + ret = munmap(p, size);<br>
<br>
</div>What is an idea to unmap one slice more than once?</blockquote></div><div>I unmap one slice only one time resulting memory will look like:</div><div> |maped|unmaped|maped|unmaped|.... </div><div class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
> + if (ret == -1) {<br>
> + err("%p-%p", p, p + size);<br>
> + return -1;<br>
> + }<br>
> + }<br>
> +<br>
> + test_waitsig();<br>
> + pass();<br>
> + return 0;<br>
> +}<br>
> --<br>
> 1.8.3.2<br>
><br>
</div>> _______________________________________________<br>
> CRIU mailing list<br>
> <a href="mailto:CRIU@openvz.org" target="_blank">CRIU@openvz.org</a><br>
> <a href="https://lists.openvz.org/mailman/listinfo/criu" target="_blank">https://lists.openvz.org/mailman/listinfo/criu</a><br>
</blockquote></div></div> </div></div>
</div><br></div>