[CRIU] [PATCH] zdtm: It's need to sleep between clock_gettime() in uptime_grow

Andrey Vagin avagin at openvz.org
Mon Jul 16 04:56:13 EDT 2012


Acked-by: Andrey Vagin <avagin at openvz.org>
On Jun 28, 2012 4:04 PM, "vkonyashkin" <vkonyashkin at parallels.com> wrote:

> Kernel can't suspend container by design if calls clock_gettime()
> in a loop, so we need to sleep between clock_gettime().
>
> Signed-off-by: Victor Konyashkin  <vkonyashkin at parallels.com>
> ---
>  test/zdtm/live/static/uptime_grow.c |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/test/zdtm/live/static/uptime_grow.c
> b/test/zdtm/live/static/uptime_grow.c
> index 1f3dba3..670c062 100644
> --- a/test/zdtm/live/static/uptime_grow.c
> +++ b/test/zdtm/live/static/uptime_grow.c
> @@ -13,8 +13,11 @@ const char *test_author = "Evgeny Antysev <
> eantyshev at parallels.com>";
>
>  int main(int argc, char **argv)
>  {
> -       struct timespec tm_old, tm;
> +       struct timespec tm_old, tm, ts;
>         double diff_nsec;
> +       ts.tv_sec = 0;
> +       ts.tv_nsec = 1000000;
> +
>         test_init(argc, argv);
>
>         if (clock_gettime(CLOCK_MONOTONIC, &tm_old)) {
> @@ -36,6 +39,12 @@ int main(int argc, char **argv)
>                         exit(1);
>                 }
>                 tm_old = tm;
> +               /*
> +               Kernel can't suspend container by design if calls
> +               clock_gettime() in a loop, so we need to sleep
> +               between clock_gettime().
> +               */
> +               nanosleep(&ts, NULL);
>         }
>         pass();
>         return 0;
> --
> 1.5.2.2
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://openvz.org/mailman/listinfo/criu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openvz.org/pipermail/criu/attachments/20120716/8acc95c5/attachment.html


More information about the CRIU mailing list