Re: [RFC PATCH v2 7/8] cpuidle: introduce irq timing to make idle prediction

From: Li, Aubrey
Date: Mon Oct 16 2017 - 02:03:56 EST


On 2017/10/14 9:01, Rafael J. Wysocki wrote:
> On Saturday, September 30, 2017 9:20:33 AM CEST Aubrey Li wrote:
>> Introduce irq timings output as a factor to predict the duration
>> of the coming idle
>>
>> @@ -342,13 +343,27 @@ void cpuidle_entry_end(void)
>> void cpuidle_predict(void)
>> {
>> struct cpuidle_device *dev = cpuidle_get_device();
>> - unsigned int overhead_threshold;
>> + unsigned int idle_interval, overhead_threshold;
>> + u64 now, next_evt;
>>
>> if (!dev)
>> return;
>>
>> overhead_threshold = dev->idle_stat.overhead * sysctl_fast_idle_ratio;
>>
>> + /*
>> + * check irq timings if the next event is coming soon
>> + */
>> + now = local_clock();
>> + local_irq_disable();
>> + next_evt = irq_timings_next_event(now);
>> + local_irq_enable();
>> + idle_interval = div_u64(next_evt - now, NSEC_PER_USEC);
>
> Another division ...
>
okay, will replace with >>10 if micro-second is agreed to be the comparing unit

Thanks,
-Aubrey