mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Muchun Song <smuchun@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>,
	sboyd@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] timers: Make the lower-level timer function first call than higher-level
Date: Wed, 21 Nov 2018 21:44:43 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.21.1811212143030.1665@nanos.tec.linutronix.de> (raw)
In-Reply-To: <CAPSr9jFVDaXUZw0LKEX81TrCmeQ+tw1bt0g_tK7J1s9qtOdEwg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2276 bytes --]

Song,

On Tue, 20 Nov 2018, Muchun Song wrote:
> John Stultz <john.stultz@linaro.org> 于2018年11月20日周二 上午2:16写道:
> >
> > On Mon, Nov 19, 2018 at 6:10 AM, Muchun Song <smuchun@gmail.com> wrote:
> > > The elements of the heads array are a linked list of timer events that
> > > expire at the current time. And it can contain up to LVL_DEPTH levels
> > > and the lower the level represents the smaller the time granularity.
> > >
> > > Now the result is that the function, which will be called when the timer
> > > expires, in the higher-level is called first than the lower-level function.
> > > I think it might be better to call the lower-level timer function first
> > > than the higher-level function. Because the lower-level has the smaller
> > > granularity and delay has less impact on higher-level. So fix it.
> >
> > Interesting.
> >
> > Do you have any specific examples of where this was helpful?  Maybe
> > data on how much this helped the case your concerned about?
> >
> 
>                      heads(with HZ > 100)
> +-----+-----+-----+-----+-----+-----+-----+-----+-----+
> |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |
> +--+--+--+--+--+--+-----+-----+-----+-----+-----+-----+
>    |     |     |
>    |     |     |
>    |     |     +--->timer4--->timer5
>    |     +--->timer1--->timer2--->timer3
>    +--->timer0
> 
> If we have 6 timers that expire at the current time. And the heads array
> layout as shown above. The collect_expired_timers() will return 3. If timer0
> belong to the first wheel level(level 0), timer1-3 belong to level 2 and
> timer4-5 belong to level 5.
> 
> Follow the current code logic, the timer0 function is called until the
> function call of timer1-5 is completed. So the delay of timer0 is the time
> spent by other timer function calls. If we can call the timer function in
> the following order, this should be more friendly to lower-level timers.
> 
>         timer0->timer1->->timer2->->timer3->->timer4->->timer5
> 
> Although not friendly to higher-level timers, higher-level has larger
> granularity. Therefore the delay has less impact on higher-level.

Well yes, that's clear. But is it a problem in practice and if so, what is
the measurable benefit.

Thanks,

	tglx

  reply	other threads:[~2018-11-21 20:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19 14:10 Muchun Song
2018-11-19 18:16 ` John Stultz
2018-11-20  2:08   ` Muchun Song
2018-11-21 20:44     ` Thomas Gleixner [this message]
2018-11-28 15:15       ` Thomas Gleixner
2018-11-28 16:51         ` Muchun Song

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.1811212143030.1665@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=smuchun@gmail.com \
    /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®