[CRIU] Re: [PATCH] uptime_grow: allow for 0 timer growth

Evgeny Antyshev eantyshev at parallels.com
Wed Jun 27 05:59:42 EDT 2012


Yes, occasionally.

On 26.06.2012 23:14, Andrew Vagin wrote:
> Have you seen this situation?
>
> On Tue, Jun 26, 2012 at 04:59:05PM +0400, Evgeny Antyshev wrote:
>> It may occur that the loop spins faster than clock ticks.
>> ---
>>   test/zdtm/live/static/uptime_grow.c |    6 +++---
>>   1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/test/zdtm/live/static/uptime_grow.c b/test/zdtm/live/static/uptime_grow.c
>> index c5eff51..1f3dba3 100644
>> --- a/test/zdtm/live/static/uptime_grow.c
>> +++ b/test/zdtm/live/static/uptime_grow.c
>> @@ -6,9 +6,9 @@ const char *test_author = "Evgeny Antysev <eantyshev at parallels.com>";
>>   #include <time.h>
>>   #include <stdlib.h>
>>   
>> -# define tv_gt(a, b) \
>> +# define tv_ge(a, b) \
>>     (((a)->tv_sec == (b)->tv_sec) ? \
>> -   ((a)->tv_nsec > (b)->tv_nsec) : \
>> +   ((a)->tv_nsec >= (b)->tv_nsec) : \
>>      ((a)->tv_sec > (b)->tv_sec))
>>    
>>   int main(int argc, char **argv)
>> @@ -29,7 +29,7 @@ int main(int argc, char **argv)
>>   			err("clock_gettime failed: %m\n");
>>   			exit(1);
>>   		}
>> -		if (!tv_gt(&tm, &tm_old)) {
>> +		if (!tv_ge(&tm, &tm_old)) {
>>   			diff_nsec = (tm_old.tv_sec - tm.tv_sec) * 1.0E9 +\
>>   				(tm_old.tv_nsec - tm.tv_nsec);
>>   			fail("clock step backward for %e nsec\n", diff_nsec);
>> -- 
>> 1.6.5.1.1367.gcd48
>>

-- 
Best regards,
Evgeny Antyshev.





More information about the CRIU mailing list