[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2007140853310.17878@somnus>
Date: Tue, 14 Jul 2020 09:08:11 +0200 (CEST)
From: Anna-Maria Behnsen <anna-maria@...utronix.de>
To: Frederic Weisbecker <frederic@...nel.org>
cc: linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] timers: Use only bucket expiry for base->next_expiry
value
Hi Frederic,
On Fri, 10 Jul 2020, Frederic Weisbecker wrote:
> Hi Anna-Maria,
>
> Nice change, it indeed makes more sense that way.
> Just a few details below:
>
> On Fri, Jul 10, 2020 at 05:46:22PM +0200, Anna-Maria Behnsen wrote:
> > Use the expiry value of the bucket into which the timer is queued to
> > do the new first timer check. This fixes the base->clk going backward
> > problem and also prevents unnecessary softirq invocations when the
> > timer->expiry is not equal to the bucket expiry time in case of a new
> > first timer which is queued in a secondary wheel level.
>
> I think there shouldn't be such unecessary softirq invocations. Either they
> fire at the bucket expiry time or the timer expiry time, it doesn't make
> much difference.
It will make a difference but only with your queue (I had the changes of
your queue already in mind, when writing the commit message)... I will
remove this.
> More important below:
>
> > -static int calc_wheel_index(unsigned long expires, unsigned long clk)
> > +static int calc_wheel_index(unsigned long expires, unsigned long clk,
> > + unsigned long *bucket_expiry)
> > {
> > unsigned long delta = expires - clk;
> > unsigned int idx;
> >
> > if (delta < LVL_START(1)) {
> > - idx = calc_index(expires, 0);
> > + idx = calc_index(expires, 0, bucket_expiry);
> > } else if (delta < LVL_START(2)) {
> > - idx = calc_index(expires, 1);
> > + idx = calc_index(expires, 1, bucket_expiry);
> > } else if (delta < LVL_START(3)) {
> > - idx = calc_index(expires, 2);
> > + idx = calc_index(expires, 2, bucket_expiry);
> > } else if (delta < LVL_START(4)) {
> > - idx = calc_index(expires, 3);
> > + idx = calc_index(expires, 3, bucket_expiry);
> > } else if (delta < LVL_START(5)) {
> > - idx = calc_index(expires, 4);
> > + idx = calc_index(expires, 4, bucket_expiry);
> > } else if (delta < LVL_START(6)) {
> > - idx = calc_index(expires, 5);
> > + idx = calc_index(expires, 5, bucket_expiry);
> > } else if (delta < LVL_START(7)) {
> > - idx = calc_index(expires, 6);
> > + idx = calc_index(expires, 6, bucket_expiry);
> > } else if (LVL_DEPTH > 8 && delta < LVL_START(8)) {
> > - idx = calc_index(expires, 7);
> > + idx = calc_index(expires, 7, bucket_expiry);
> > } else if ((long) delta < 0) {
> > idx = clk & LVL_MASK;
>
> You also need to handle that part. That's in fact the critical one :)
>
damn... too many idx here...
Thanks,
Anna-Maria
Powered by blists - more mailing lists