[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200717125555.GB25465@lenoir>
Date: Fri, 17 Jul 2020 14:55:56 +0200
From: Frederic Weisbecker <frederic@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Anna-Maria Gleixner <anna-maria@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>
Subject: Re: [PATCH 2/9] timer: Add comments about calc_index() ceiling work
On Tue, Jul 14, 2020 at 11:13:26AM +0200, Thomas Gleixner wrote:
> Frederic Weisbecker <frederic@...nel.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.
Me too...
>
> /*
> * 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?
That's relieving, I'm updating the patch.
Thanks!
Powered by blists - more mailing lists