[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPSr9jFVDaXUZw0LKEX81TrCmeQ+tw1bt0g_tK7J1s9qtOdEwg@mail.gmail.com>
Date: Tue, 20 Nov 2018 10:08:13 +0800
From: Muchun Song <smuchun@...il.com>
To: John Stultz <john.stultz@...aro.org>
Cc: tglx@...utronix.de, sboyd@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] timers: Make the lower-level timer function first call
than higher-level
Hi John,
Thanks for your review.
John Stultz <john.stultz@...aro.org> 于2018年11月20日周二 上午2:16写道:
>
> On Mon, Nov 19, 2018 at 6:10 AM, Muchun Song <smuchun@...il.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.
Is it right?
Thanks.
Powered by blists - more mailing lists