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

Victor konyashkin vkonyashkin at parallels.com
Mon Jul 16 04:52:01 EDT 2012


What about this patch?
On Thu, 2012-06-28 at 16:03 +0400, vkonyashkin 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;



More information about the CRIU mailing list