@@ -244,6 +244,9 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
unsigned int duration_us, count;
int max_early_idx, idx, i;
ktime_t delta_tick;
+ ktime_t now = ktime_get();
+ ktime_t next_hrtimer = tick_nohz_get_next_hrtimer();
+ ktime_t next_timer = tick_nohz_get_next_timer();
if (cpu_data->last_state >= 0) {
teo_update(drv, dev);
@@ -252,7 +255,8 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
cpu_data->time_span_ns = local_clock();
- cpu_data->sleep_length_ns = tick_nohz_get_sleep_length(&delta_tick);
+ cpu_data->sleep_length_ns = ktime_sub(next_timer, now);
+ delta_tick = ktime_sub(next_hrtimer, now);
duration_us = ktime_to_us(cpu_data->sleep_length_ns);
count = 0;