lkml.org 
[lkml]   [2020]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/9] timer: Add comments about calc_index() ceiling work
Date
Frederic Weisbecker <frederic@kernel.org> writes:
> static inline unsigned calc_index(unsigned expires, unsigned lvl)
> {
> + /*
> + * Time may have past since the clock last reached an index of
> + * this @lvl. And that time, below LVL_GRAN(@lvl), is going to
> + * be substracted from the delta until we reach @expires. To
> + * fix that we must add one level granularity unit to make sure
> + * we rather expire late than early. Prefer ceil over floor.

This comment confuses the hell out of me.

/*
* The timer wheel has to guarantee that a timer does not fire
* early. Early expiry can happen due to:
* - Timer is armed at the edge of a tick
* - Truncation of the expiry time in the outer wheel levels
*
* Round up with level granularity to prevent this.
*/

Hmm?

Thanks,

tglx

\
 
 \ /
  Last update: 2020-07-14 11:14    [W:0.108 / U:8.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site