lpm-levels: Don't stop the tick if it's not beneficial

There is no point in stopping the scheduler tick if the expected
idle duration is shorter than the tick period length.

Change-Id: I8d499c9b2dcf1cd3c8401cc2002ee8b485023ff0
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Alexander Winkowski 2022-04-02 14:31:12 +00:00 committed by Richard Raya
parent 374cf03e25
commit 2fed88beb9

View File

@ -488,6 +488,14 @@ static bool psci_enter_sleep(struct lpm_cpu *cpu, int idx, bool from_idle)
static int lpm_cpuidle_select(struct cpuidle_driver *drv,
struct cpuidle_device *dev, bool *stop_tick)
{
#ifdef CONFIG_NO_HZ_COMMON
ktime_t delta_next;
s64 duration_ns = tick_nohz_get_sleep_length(&delta_next);
if (duration_ns <= TICK_NSEC)
*stop_tick = false;
#endif
return 0;
}