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

vkonyashkin vkonyashkin at parallels.com
Thu Jun 28 08:03:59 EDT 2012


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



More information about the CRIU mailing list