Re: [PATCH V3 2/2] sched: idle: IRQ based next prediction for idle period
From: Rafael J. Wysocki
Date: Wed Feb 17 2016 - 18:22:08 EST
On Thu, Feb 18, 2016 at 12:09 AM, Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
> On Tue, Feb 16, 2016 at 5:44 PM, Nicolas Pitre <nicolas.pitre@xxxxxxxxxx> wrote:
>> On Tue, 16 Feb 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 compute 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.
>>>
>>> Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
>>
>> The math in next_irq_event() is correct even though I think it could be
>> done more simply. But that can be optimized at a later time.
>>
>> Reviewed-by: Nicolas Pitre <nico@xxxxxxxxxx>
>
> Well, I'm likely overlooking something, but how is this going to be
> hooked up to the code in idle.c?
My somewhat educated guess is that sched_idle() in your patch is
intended to replace cpuidle_idle_call(), right?
If so, why do you want to replace it?
And assuming that you have a good enough reason to do that, you need
to ensure that suspend-to-idle will work anyway.
Thanks,
Rafael