mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anna-Maria Behnsen <anna-maria@linutronix.de>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] timers: Use only bucket expiry for base->next_expiry value
Date: Tue, 14 Jul 2020 09:08:11 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2007140853310.17878@somnus> (raw)
In-Reply-To: <20200710214458.GA31351@lenoir>

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


      reply	other threads:[~2020-07-14  7:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 15:46 Anna-Maria Behnsen
2020-07-10 21:44 ` Frederic Weisbecker
2020-07-14  7:08   ` Anna-Maria Behnsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.2007140853310.17878@somnus \
    --to=anna-maria@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®