Re: [patch 1/3] cyclictest: Ensure that next wakeup time is never in the past

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 26 May 2015, anna-maria@xxxxxxxxx wrote:

> The calculated next wakeup time is already in the past, if the latency
> is longer than the interval. Thereby latency is detected that does not
> correspond to latency caused by the system but by cyclictest itself.
> 
> Force forward the next wakeup time past now.
> 
> Signed-off-by: Anna-Maria Gleixner <anna-maria@xxxxxxxxx>
> ---
>  src/cyclictest/cyclictest.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> Index: rt-tests/src/cyclictest/cyclictest.c
> ===================================================================
> --- rt-tests.orig/src/cyclictest/cyclictest.c
> +++ rt-tests/src/cyclictest/cyclictest.c
> @@ -369,6 +369,12 @@ static inline void tsnorm(struct timespe
>  	}
>  }
>  
> +static inline int tsgreater(struct timespec *a, struct timespec *b)
> +{
> +	return ((a->tv_sec > b->tv_sec) ||
> +		(a->tv_sec == b->tv_sec && a->tv_nsec > b->tv_nsec));
> +}
> +
>  static inline int64_t calcdiff(struct timespec t1, struct timespec t2)
>  {
>  	int64_t diff;
> @@ -949,6 +955,12 @@ void *timerthread(void *param)
>  		}
>  		tsnorm(&next);
>  
> +		while (tsgreater(&now, &next)) {
> +			next.tv_sec += interval.tv_sec;
> +			next.tv_nsec += interval.tv_nsec;
> +			tsnorm(&next);
> +		}
> +
>  		if (par->max_cycles && par->max_cycles == stat->cycles)
>  			break;
>  	}
> 
> 
> --

Applied, this one will be in the next build
Thanks!

John Kacur
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux