Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1305714
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period |
| Date | 2016-01-10 23:40 +0100 |
| Message-ID | <qPwOt-1Sj-9@gated-at.bofh.it> (permalink) |
| References | <qNYc9-2Y2-7@gated-at.bofh.it> <qNYc9-2Y2-5@gated-at.bofh.it> <qO0nF-4iF-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 01/06/2016 06:40 PM, Nicolas Pitre wrote:
> On Wed, 6 Jan 2016, Daniel Lezcano wrote:
>
>> Many IRQs are quiet most of the time, or they tend to come in bursts of
>> fairly equal time intervals within each burst. It is therefore possible
>> to detect those IRQs with stable intervals and guestimate when the next
>> IRQ event is most likely to happen.
>>
>> Examples of such IRQs may include audio related IRQs where the FIFO size
>> and/or DMA descriptor size with the sample rate create stable intervals,
>> block devices during large data transfers, etc. Even network streaming
>> of multimedia content creates patterns of periodic network interface IRQs
>> in some cases.
>>
>> This patch adds code to track the mean interval and variance for each IRQ
>> over a window of time intervals between IRQ events. Those statistics can
>> be used to assist cpuidle in selecting the most appropriate sleep state
>> by predicting the most likely time for the next interrupt.
>>
>> Because the stats are gathered in interrupt context, the core computation
>> is as light as possible.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[ ... ]
>> +
>> + diff = ktime_sub(now, w->timestamp);
>> +
>> + /*
>> + * There is no point attempting predictions on interrupts more
>> + * than 1 second apart. This has no benefit for sleep state
>> + * selection and increases the risk of overflowing our variance
>> + * computation. Reset all stats in that case.
>> + */
>> + if (unlikely(ktime_after(diff, ktime_set(1, 0)))) {
>> + stats_reset(&w->stats);
>> + continue;
>> + }
>
> The above is wrong. It is not computing the interval between successive
> interruts but rather the interval between the last interrupt occurrence
> and the present time (i.e. when we're about to go idle). This won't
> prevent interrupt intervals greater than one second from being summed
> and potentially overflowing the variance if this code is executed less
> than a second after one such IRQ interval. This test should rather be
> performed in sched_idle_irq().
Hi Nico,
I have been through here again and think we should duplicate the test
because there are two cases:
1. We did not go idle and the interval measured in sched_idle_irq is
more than one second, then the stats are reset. I suggest to use an
approximation of one second: (diff < (1 << 20)) as we are in the fast
path.
2. We are going idle and the latest interrupt happened one second apart
from now. So we keep the current test.
-- Daniel
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-06 16:30 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-01-06 18:50 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-07 16:50 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-01-12 20:30 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-10 23:40 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-01-10 23:50 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-11 00:00 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-01-11 00:20 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Thomas Gleixner <tglx@linutronix.de> - 2016-01-08 16:50 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-12 13:50 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Thomas Gleixner <tglx@linutronix.de> - 2016-01-12 14:50 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-12 15:20 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Thomas Gleixner <tglx@linutronix.de> - 2016-01-12 15:30 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-12 16:00 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Thomas Gleixner <tglx@linutronix.de> - 2016-01-12 16:20 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-12 17:10 +0100
Re: [RFC PATCH 2/2] sched: idle: IRQ based next prediction for idle period Thomas Gleixner <tglx@linutronix.de> - 2016-01-13 10:20 +0100
csiph-web